Status Report For Ndsev 2015-07-20
Status Report For Ndsev 2015-07-20
2015-07-20
User: wlessguest
Pw: Qu!ckj0urn3y
15 Years of SQLite
500000
400000
300000
200000
100000
0
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
2000
3.8.0: 1408M cycles
1500
1000
500
1.5
0.5
0
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
2000
1500
1000
500
0
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
3.8.8
3.8
.3
3.8
.2
ov
ov
Fe
3
ov
Fe
Fe
3.8.7
N
N
3.8.1
b
b
Sep Oct
Mar Apr
Sep Oct
Sep Oct
Mar Apr M
Mar Apr M
2013 2014 2015
eim
Hildesh 3.8.9
g
M
g
Au
g
Au
ay
Au
ay
3.
ay
Jul Jun
0 8.
Jul Jun Jun
8.
Jul
6 1
3. . 8. 0
11
3
3.8
.
sum
3.8
.
Berlin
Har
Events In Past Year
3.8.8
Jan
Dec
ov
Fe
N
b
3.8.7
Mar
O ct 2014
2015
Sep
Apr
3.8.9
M
g
Au
ay
3.
8.
Jul Jun
6 10
. 8.
3
.11
3.8
rs um
Ha
Page Cache Bulk Memory Allocation
sqlite3_config(SQLITE_CONFIG_PAGECACHE, NULL, 0, 0);
UPDATE tab
Yes SET flags = flags | 0x1b
WHERE id=?;
https://www.sqlite.org/src/repo-tabsize
PRAGMA cell_size_check
● Earlier detection of database corruption
● Prevents potential read past end of buffer on
a corrupt database file
matchinfo(tab,'by')
● 'y' The number of matches for each term.
● 'b' Bitvector with 1 for each matching
term.
SQLITE_CONFIG_PCACHE_HDRSZ
● Number of bytes of extra space needed by
each page-cache line.
– Value is compiler and architecture specific
● Useful in combination with
SQLITE_CONFIG_PAGECACHE.
Unicode61 tokenizer
● Now included by default
INSERT by rowid in spellfix1
Improved Documentation
● Each object includes a list of methods
Partial Sorting By Index
CREATE TABLE t1(a,b,c);
CREATE INDEX t1a ON t1(a);
SELECT * FROM t1
WHERE x IN (SELECT DISTINCT b FROM t2 WHERE a>55)
IS operator can drive an index
Returns no rows if NULL, even if
one or more “x” values in the table
are NULL.
SELECT * FROM t1
WHERE a=?1 AND c=?2
ORDER BY d;
SELECT * FROM t1
WHERE a=?1 AND c=?2
AND b IN (SELECT b FROM t1)
ORDER BY d;
OR optimized on WITHOUT ROWID
CREATE TABLE t3(
id TEXT PRIMARY KEY,
a TEXT,
b TEXT,
c BLOB
) WITHOUT ROWID;
CREATE INDEX t3a ON t3(a);
CREATE INDEX t3b ON t3(b);
SELECT * FROM t3
WHERE a='hello' OR b='world';
sqldiff.exe
● Compare two SQLite database files
● --schema Show only schema differences
● --summary Summary (change counts)
● --table TAB Table TAB only
sqlite3.exe: “.system” and “.once”
.header on
.mode csv
.once c:/work/dataout.csv
SELECT * FROM tab1;
.system c:/work/dataout.csv
sqlite3.exe: “.once”
SELECT writefile(printf('c:/file%03d.bin',id), x)
FROM data;
sqlite3.exe: readfile() & writefile()
● 100 data file in c:/file001.bin, c:/file002.bin, ...
● Want to read all 100 files into the DATA table:
WITH RECURSIVE
cnt(ii) AS (VALUES(1)
UNION ALL
SELECT ii+1 FROM cnt WHERE ii<100)
INSERT INTO data(id, x)
SELECT ii, readfile(printf('c:/file%03d.bin',ii))
FROM cnt;
sqlite3.exe: “.fullschema”
● Complete schema dump, as with “.schema”
● Also includes content of sqlite_stat1 and
sqlite_stat4 tables.
● Please use when reporting query planner
issues!
sqlite3.exe DBNAME .dbinfo
database page size: 4096
write format: 1
read format: 1
reserved bytes: 0
file change counter: 4
database page count: 14150
freelist page count: 0
schema cookie: 106
schema format: 4
default cache size: 0
autovacuum top root: 0
incremental vacuum: 0
text encoding: 1 (utf8)
user version: 0
application id: 0
software version: 3008010
number of tables: 53
number of indexes: 53
number of triggers: 0
number of views: 0
schema size: 14257
sqlite3.exe - advanced options
● Debugging compile-time options:
– -DSQLITE_DEBUG
– -DSQLITE_ENABLE_EXPLAIN_COMMENTS
– -DSQLITE_ENABLE_SELECTTRACE
– -DSQLITE_ENABLE_WHERETRACE
● .selecttrace 0xfff
● .wheretrace 0xfff
sqlite3.exe - advanced options
.selecttrace 0xfff
SELECT count(*) FROM t1 LEFT JOIN t2 ON t1.i=t2.i AND bool='T';
' SELECT agg_flag (0x17A7380) selFlags=0x6c
| resultset
| ' AGG_FUNCTION0 'count'
| FROM
| | {0,*} t1 tabname='t1'
| ' {1,*} t2 tabname='t2' LEFTJOIN
' WHERE
' AND flags=0x20005
| EQ flags=0x20005
| | {0:0} flags=0x20005
| ' {1:0} flags=0x120005
' EQ flags=0x20005
| {1:1} flags=0x120005
' 'T'