On 1/7/15, Max Vasilyev <maxrea...@gmail.com> wrote: > Hi guys, > Is it possible to get key number from the index? > For example let's consider Figure 4: An Index On The Fruit Column from here > https://www.sqlite.org/queryplanner.html > > index_rownum, fruit, rowid > 1 Apple 2 > 2 Grape 5 > 3 Lemon 18 > 4 Orange 1 > 5 Orange 23 > ... > > Is it possible to add rownum column and store it in the index? And get it > in the query? >
No, that information is not available in the SQLite Btree design. When I was designing the Btree (back in 2003) I considered adding the capability to compute the "rownum" in O(logN) time. That would have made things like "count(*)" much faster too. But doing this also increases insertion and deletion cost, so I decided against doing it. -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users