index_list
The sqlite shell command .schema
does not explicitely display the indexes created for unique columns. These indexes can be shown however with index_list
.
create table t1 (id integer primary key, txt text not null , val double);
create table t2 (id integer primary key, txt text not null unique, val double);
The following statement returns an empty set:
pragma index_list('t1');
For t2
, the index for the unique index is shown:
pragma index_list('t2');
--
-- 0|sqlite_autoindex_t2_1|1|u|0
See also the index_info
pragma, which shows the columns of an index:
pragma index_info('sqlite_autoindex_t2_1');
--
-- 0|1|txt
page_size, page_count
pragma page_size
returns the size of a page in bytes (for example 4096) and page_count
the number of pages in the database.
Thus, page_size
multiplied by page_count
is the total size of the database in bytes.
Compare with
select pageno, pgoffset, pgsize from dbstat
.
synchronous
pragma synchronous = OFF
prevents
SQLite from doing
fsync
's when writing.
This helps improve the
performance, however, the database is not transactionally safe anymore.
** Note that (for historical reasons) the PAGER_SYNCHRONOUS_* macros differ
** from the SQLITE_DEFAULT_SYNCHRONOUS value by 1.
**
** PAGER_SYNCHRONOUS DEFAULT_SYNCHRONOUS
** OFF 1 0
** NORMAL 2 1
** FULL 3 2
** EXTRA 4 3
**
** The "PRAGMA synchronous" statement also uses the zero-based numbers.
** In other words, the zero-based numbers are used for all external interfaces
** and the one-based values are used internally.
*/
#ifndef SQLITE_DEFAULT_SYNCHRONOUS
# define SQLITE_DEFAULT_SYNCHRONOUS 2
#endif
#ifndef SQLITE_DEFAULT_WAL_SYNCHRONOUS
# define SQLITE_DEFAULT_WAL_SYNCHRONOUS SQLITE_DEFAULT_SYNCHRONOUS
#endif