Suppose I have the following table:
        CREATE TABLE t (a, b);
with a few million rows of random data in.  Suppose there are no indexes on the 
table.

I create the following index on the table:
        CREATE INDEX t_b ON t (b);
There are two ways to make the index.

(A) Go through the table in row order adding each row to the index, modifying 
the tree as you go.

(B) Use the same strategy as you would for the command
        SELECT * FROM t ORDER BY B
using any existing index or creating a temporary one as required.  This 
presents the table's rows to you in index order, allowing you to create the 
tree structure as you go.

Which does SQLite do ?  Is there an argument for doing (B) because it means 
that the tree structure can be written in order which may be more efficient.

I'm aware that any temporary index created as part of (B) involves the same 
work it would do in (A), I'm just curious about the effects.

Simon.

Reply via email to