On Sun, 2005-08-21 at 04:24 +0530, Ligesh wrote: > On Sun, Aug 21, 2005 at 12:30:25AM +0200, Ulrik Petersen wrote: > > > > > >select * from table where parent_name = 'parent' order by name limit 10 > > >
> I am running on linux, and I will need this to scale to at least > 200,000 rows If you upgrade to the vary latest code in CVS (version 3.2.2+) and you create an index like this: CREATE INDEX idx ON table(parent_name, name); Then the query above should be very efficient. You can try it creating the index above with version 2.x. It might work. I do not remember how smart the optimizer was about using indexes to optimize sorting in version 2.x (that was so long ago.) If you really need to use 2.8, you could just create the index above, make sure that it is the *only* index on the table, then omit the ORDER BY clause all together. When the index above is used, things will come out sorted or by name just because of the way they work in SQLite. SQL does not guarantee that behavior so it probably will not work that way on other database engines, but it should work fine in SQLite. -- D. Richard Hipp <[EMAIL PROTECTED]>

