select column0
from CustomerData as cd
where column1 = 10
and column0 >= 50
AND
( SELECT count(*)
from CustomerData
where column1 = 10
and column0 = cd.column0 + 1) = 0
order by column0
limit 1
Competing products sometimes to a better job of optimizing queries.
select column0
from CustomerData as cd
where column1 = 10
and column0 >= 50
AND
NOT EXISTS ( SELECT *
from CustomerData
where column1 = 10
and column0 = cd.column0 + 1)
order by column0
limit 1
| Subject | Views | Written By | Posted |
|---|---|---|---|
| query to find gaps in sequential indexes causes CPU spikes | 1222 | Chris Nevin | 11/22/2011 12:50PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 522 | Rick James | 11/23/2011 11:01PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 595 | Chris Nevin | 11/25/2011 05:19PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 547 | Rick James | 11/26/2011 06:02PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 681 | Chris Nevin | 11/28/2011 04:58PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 618 | Rick James | 11/29/2011 09:23PM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 386 | Chris Nevin | 11/30/2011 10:41AM |
| Re: query to find gaps in sequential indexes causes CPU spikes | 627 | Rick James | 12/01/2011 10:13AM |
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.