What is the best index for this query??
Posted by:
hrg wea
Date: February 27, 2008 02:51PM
I have the following table:
create table comment(
id int not null auto_increment ,
userId int not null ,
content text ,
timeStamp int not null ,
primary key(id)
) ;
And the following query:
SELECT * FROM comment WHERE userId = 10 and timeStamp < 11981234 ORDER BY timeStamp DESC
What is the best index to use so this query is performed the fastest way posible??
I think of two possibilities:
The first one:
index(userId,timeStamp)
and the second one:
index(userId),
index(timeStamp)
which option is the best for this query and why??
Thanks in advance.
Subject
Views
Written By
Posted
What is the best index for this query??
1954
February 27, 2008 02:51PM
1265
February 27, 2008 07:45PM
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.