Skip to main content
Giambattista Scivoletto
Participant
October 22, 2011
Question

Help with a Index on sql server

  • October 22, 2011
  • 1 reply
  • 1223 views

I have a table named AVAILABILITY

ID - IDHOTEL - IDROOM - DATE_FROM - DATE_TO

for each room a hotel insert a period (from - to) when the room in booked

Considering this query

select id, date_from, date_to from AVAILABILITY

where IDHOTEL = #idhotel#

   and IDROOM = #idroom#

   and DATE_TO >= #dateadd("d",-1,now())#

order by DATE_FROM

Could you suggest me a index to create on the table ?

This topic has been closed for replies.

1 reply

Inspiring
October 22, 2011

What are the existing indexes?

Giambattista Scivoletto
Participant
October 23, 2011

Actually I have these:

unique clustered index idhotel, idroom, date_from, date_to

non clustered index ID

Inspiring
October 24, 2011

Why do you think you need another one?  Is your query slow?  Using cfqueryparam will speed it up.