Re: [sqlite] Re: speed of ORDER BY clause?

2006-06-14 Thread joe
On Jun 14, 2006, at 16:15 UTC, Igor Tandetnik wrote:

> > SELECT  FROM  WHERE recID IN () ORDER BY
> > dateFld
> 
> Why not just
> 
> select  from  order by dateFld;
> 
> ?

Because that gets me all records.  I only want those in my list of record IDs 
(which comes from another source, outside the database).

> Can you show the exact query you use?

Well, no, because there are about 20 fields in  and 13000 values in 
.  Note that  does include both recID and dateFld, if that 
matters.  But apart from showing the actual field and value list, and the table 
name, the above query IS the exact query I use.

> There must be more to your query - something that prevents an index on
> dateFld from being used.

That's what it seems; I just can't imagine what that could be.

Thanks,
- Joe

--
Joe Strout -- [EMAIL PROTECTED]
Verified Express, LLC "Making the Internet a Better Place"
http://www.verex.com/



[sqlite] Re: speed of ORDER BY clause?

2006-06-14 Thread Igor Tandetnik

joe-QzMH92Wc/[EMAIL PROTECTED] wrote:

I'm finding that ORDER BY is surprisingly slow, and it makes me
wonder if I'm doing something wrong.  Here's the situation:

I need to select a large set of records out of a table, sort them by
one column, and then get just a subset of the sorted list.  (For
example, I might want records 40-60 ordered by date, which is a
completely different set than records 40-60 ordered by user ID.)  I
start with the full list of record IDs I want, and a query something
like this:

SELECT  FROM  WHERE recID IN ( ORDER BY
dateFld


Why not just

select  from  order by dateFld;

? Can you show the exact query you use? There must be more to your 
query - something that prevents an index on dateFld from being used.


Igor Tandetnik