Try select * from (select * from T where 123<= y) where 123 >= x

On Thursday, March 19, 2015 at 6:36:04 AM UTC+2, Akhil Kodali wrote:
>
> Hi,
>
> I have a table T (x: BIGINT(19), y: BIGINT(19))
> There are over 25 million rows in the Table
>
> And I created an index each on 'x' and 'y'. There us no primary key
>
> When I do 
> explain analyze select * from T where 123 >= x and 123 <= y
> It takes over 5 minutes and shows over 25 Million rows were scanned
> And there is a match on only 1 record
>
> Any pointers how do I improve performance on these kinda range queries ?
>
> Akhil
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to