Trey Mack wrote:
> I have a fairly large table (10million rows) with a simple INTEGER
> PRIMARY KEY AUTOINCREMENT field.
>
> Executing 'SELECT max(rowid) FROM MyTable' is very fast, as is
> 'SELECT min(rowid) FROM MyTable'.
>
> However, 'SELECT max(rowid) - min(rowid) FROM MyTable' is slow
> (
> I have a fairly large table (10million rows) with a simple INTEGER
> PRIMARY KEY AUTOINCREMENT field.
>
> Executing 'SELECT max(rowid) FROM MyTable' is very fast, as is
> 'SELECT min(rowid) FROM MyTable'.
>
> However, 'SELECT max(rowid) - min(rowid) FROM MyTable' is slow
> (apparently accessi
someone else might give a more technical and scientific explanation,
but my take is that "SELECT n FROM table" is just that -- a row
returned for every row in the table because there is no WHERE clause
constraining the results. "SELECT max() - 1 FROM table" on the
other hand GROUPs the result
Ah, OK, I see that doing 'SELECT 1 FROM MyTable' returns a 1 for every
row, so I can see where the effort is probably going. However, 'SELECT
max(rowid) - 1 FROM MyTable' still only produces one result row
(obviously I'm experimenting with a much smaller database now). Still
need an explanatio
I have a fairly large table (10million rows) with a simple INTEGER
PRIMARY KEY AUTOINCREMENT field.
Executing 'SELECT max(rowid) FROM MyTable' is very fast, as is 'SELECT
min(rowid) FROM MyTable'.
However, 'SELECT max(rowid) - min(rowid) FROM MyTable' is slow
(apparently accessing every r
5 matches
Mail list logo