On Mon, Oct 10, 2011 at 10:27 AM, cricketfan wrote:
>
> SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;
>
> Since I have the index on PK1, I believe the rows will be returned in the
> ORDER of PK1. Putting an ORDER BY clause will be a no-op.
> Do you think
cricketfan wrote:
> SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;
>
> Since I have the index on PK1, I believe the rows will be returned in the
> ORDER of PK1. Putting an ORDER BY clause will be a no-op.
Probably, but that's an implementation detail. If
SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;
Since I have the index on PK1, I believe the rows will be returned in the
ORDER of PK1. Putting an ORDER BY clause will be a no-op.
Do you think otherwise?
Gabríel A. Pétursson wrote:
>
> Be aware that if you do not specify an
Be aware that if you do not specify an ORDER BY clause, the order of the
returned rows are undefined. You might not even end up with rows with a
primary key even near 100.
What you probably want is:
SELECT * FROM test WHERE PK1 > 100 LIMIT 100 ORDER BY PK1 ASC;
Other than that, those two
> SELECT * from test WHERE PK1>100 AND PK1<200;>> SELECT * from test WHERE
> PK1>100 LIMIT 100;>> Will the above queries have the same effect? Or will
> LIMIT behave> differently, i.e. get the entire result set and then return the
> first 100> from it?
If your PK1 has no gaps then those two
5 matches
Mail list logo