Can you create a second table holding the minimum rowid and maximum rowid from 
your main data table. You query this table, get the range or rowid, then you 
can query the main table WHERE rowid >= MinRowid AND rowid <= MaxRowid. That 
would than use the built in primary index.

David


--- On Mon, 4/14/08, Chris Tracy <[EMAIL PROTECTED]> wrote:

> From: Chris Tracy <[EMAIL PROTECTED]>
> Subject: Re: [sqlite] Implicit INDEX?
> To: "General Discussion of SQLite Database" <[email protected]>
> Date: Monday, April 14, 2008, 1:35 PM
> >  If you need to do this from the shell, I'm not
> sure there is anything
> >  you can do.  If you're doing this from the C API
> just look for timestamps
> >  that are >= your target and terminate the query as
> soon as you find one
> >  larger than the target timestamp (e.g. stop calling
> step() and call
> >  reset() on the statement).  If the number of
> datapoints at a given
> >  timestamp is known (because it is fixed, or because
> you stashed that
> >  value in another table), you could also use a LIMIT
> clause.  That has
> >  the added bonus of doing the right thing (even if it
> takes longer) if
> >  the rows somehow get out-of-order.
> 
>       I'm actually using Perl's DBI interface.  Not
> sure that I can 
> easily do the exit when seeing a timestamp one bigger than
> the one I'm 
> after, but it's an intriguing idea I'd not
> considered before.  The LIMIT 
> I'd also considered, but since the data is variable,
> I'd abandoned it. 
> Hadn't considered storing the value in another table. 
> But since the whole 
> thing was based on an invalid premise (that SQLite was
> somehow magically 
> finding the initial value quickly, ignoring that it just
> happened to be 
> closer to the start of the db) I think I'll take
> another approach to 
> solving the problem.
> 
>       Thanks for the input though,
> 
>       Chris
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to