Date sent:              Thu, 01 Jan 2004 23:42:17 +0100
To:                     [EMAIL PROTECTED]
From:                   Hennie Peters <[EMAIL PROTECTED]>
Subject:                Re: [sqlite] Find a row

> to get the number of rows:
> select count(*) from testtableint;
> or the next on might be quicker:
> select count(1) from testtableint;

It does visit all rows

8|Rewind|0|13|
9|Integer|1|0|1
10|Integer|0|0|
11|AggFunc|0|1|ptr(0x4416b0)
12|Next|0|9|
13|Close|0|0|
14|AggNext|0|18|
15|AggGet|0|0|

but it does nothing with them, maybe it is most quick, does someone has comment 
on this.

thanks 
Bert Verhees

> 
> How can you be sure that the first row contains the lowest rowid when doing:
> "select rowid,..... from testtableint where rowid>2 limit 1"
> Would you need to do:
> "select rowid,..... from testtableint where rowid>2 order by rowid limit 1"
> or does sqlite order on rowid by default ?
> 
> At 23:15 1-1-2004 +0100, [EMAIL PROTECTED] wrote:
> > >
> > > Is it really much quicker than:
> > > select min(rowid) from testtableint having rowid>2;
> > > and is there a way to show the time a query takes to execute ?
> >
> >I guess this what you mean:
> >select min(rowid) from testtableint where rowid>2
> >because having can only be used together with "group by"
> >
> >I think it is not that fast because it has to do aggregate-functions, 
> >which mean an
> >extra overhead, and extra above this fact, it is impossible to retrieve 
> >other fields
> >when doing an aggregate, which means two queries have to be executed to get
> >the compleet row.
> >
> >But now we are here, is there a way to retrieve the number of rows a table 
> >has
> >without getting all the rows?
> >
> >thanks in advance
> >
> >Bert Verhees
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to