Hi All,
just an update.
I have added 2 new iterators for SQL tables.
They are roughly documented here:
http://code.google.com/p/alchemydatabase/wiki/HighLights
The SCION iterator, uses counts of descendants at each btree node to
efficiently do "SELECT * FROM TABLE ORDER by pk LIMIT 10 OFFSET
9999999" queries. Finding the 9999999th row is done efficiently.
The SCION Iterator is even efficent w/ the following query:
"SELECT * FROM TABLE WHERE pk BETWEEN 666666 AND 777777 ORDER by pk
LIMIT 10 OFFSET 9999999"
which is more difficult as the 666666th entry is located deep in the
Btree.
The SCION iterator works for PKs and FKs.
Reverse Iterators are now available for both PKs and FKs, and in combo
w/ the SCION iterator.
The ORDERBY index is pretty cool. Normally, when you do a "SELECT *
FROM user_actions WHERE user_id =2" [user_id is an FK] you will get
rows back sorted to PK ASC. Using a ORDERBY index, the rows can be
sorted (in the index) to a different column (for example a timestamp
column) and the rows will be now be returned in timestamp order.
The ORDERBY index is incredibly useful for timestamp like queries that
need ORDERBY timestamp ... think my most recent 10 tweets. Relying on
the natural order you INSERT such rows does not work in distributed
environments, it is best to have a specific ordering ...
ORDERBY, SCION, & Reverse all work w/ one another (and as
MultipleColumnIndexes).
These iterators have all been tested to 10M PKs & 3M FKs ... they are
fast.
Enjoy
- jak