Re:Hosting SQLite databases on GitHub Pages or any static fi...
by fulafel on Sunday May 02, 2021 @03:39PM
(#27018286)
B-Tree indexes are designed to work like this, to require a low number of IO operations. The index contains pointers to other places in the index.
[ Parent
| on HN ]
Re:Hosting SQLite databases on GitHub Pages or any static fi...
by pudmaidai on Sunday May 02, 2021 @03:55PM
(#27018445)
So the answer is “yes, it has to download the index first”? None of these comments answer my question.
Re:Hosting SQLite databases on GitHub Pages or any static fi...
by phiresky on Sunday May 02, 2021 @04:30PM
(#27018731)
The B-Tree is a tree that in this case is perfectly balanced. So if you do a query with an index in a database it will fetch an logarithmic amount of data from the index and then a constant amount of data from the table.
For the example the wdi_data table is 300MB and an index on it is 100MB in size. This index has a tree depth of 4 - which means SQLite has to read exactly 4 pages (4KiB) to get to the bottom of it and find the exact position of the actual row data.
you can check the depth of the b-trees with `sqlite3_analyzer`.
Re:Hosting SQLite databases on GitHub Pages or any static fi...
by rakoo on Sunday May 02, 2021 @05:07PM
(#27019034)
Everything in SQLite is stored in B-Trees. Data or indexes. So you don't need to download the whole index first; you only need to download the necessary pages of the trees to access data, whether it's part of an index or actual data
Re:Hosting SQLite databases on GitHub Pages or any static fi...
by detaro on Sunday May 02, 2021 @03:57PM
(#27018460)
At least the information describing what tables and indices there are and where to find them - and then it gets what it needs once a query is run. Just like sqlite would if running from a local file on disk.
Re:Hosting SQLite databases on GitHub Pages or any static fi...
by tehbeard on Sunday May 02, 2021 @05:12PM
(#27019071)
It just needs to download the pages (x KB chunks) to traverse from the header to the particular index and table schema, a fraction of the whole data.