MySQL Forums
Forum List  »  Performance

select value between (start , end) optimisation
Posted by: Mathieu Pichon
Date: December 22, 2004 03:21AM

WHAT I HAVE :

Given a huge table that contains two (BIGINT) fields :
- start_field
- end_field.

There is indexes on
- start_field
- end_field

WHAT I NEED TO DO

I need to find record where :
- start_field < value AND end_field > value

WHAT HAPPEN

if value is small regarding all value it can take, using the start_field index is not efficient as it need to parse all the other for end_field condition

if value is big, using end_field is not efficient.

and if value is in the middle the querry takes very long time

HOW CAN I IMPROVE PERFORMANCE ?

Regarding that the average (start_field - end_field ) field is not so big ?

Options: ReplyQuote


Subject
Views
Written By
Posted
select value between (start , end) optimisation
6510
December 22, 2004 03:21AM


Sorry, you can't reply to this topic. It has been closed.

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.