dbTalk Databases Forums  

clustered index

microsoft.public.sqlserver.clustering microsoft.public.sqlserver.clustering


Discuss clustered index in the microsoft.public.sqlserver.clustering forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Emil
 
Posts: n/a

Default clustered index - 10-08-2008 , 10:17 AM






is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli

Reply With Quote
  #2  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM






First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #3  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #4  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #5  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #6  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #7  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #8  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #9  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
  #10  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: clustered index - 10-08-2008 , 06:36 PM



First off this is a Clustering group which is a High Availability topic not
indexes. But in any case there is no need to specify a hint in this case and
rarely any other if you have the correct indexes to begin with. In this case
the column is a PK. That means there can only ever be at most 1 row that
matches the value you supply with a = expression in the WHERE clause. Since
it is a PK there should be a Primary Key constraint on it and it uses an
index to enforce the constraint. So the optimizer will favor this index in
this scenario and there should be no need what so ever for a hint. Never use
hints unless you are sure there is a valid reason to and never assume a hint
is the first recourse. Now the question of should this be a clustered index
and will it be faster than a non-clustered index depends on how you access
the table overall. If you always query by the PK then making it the
clustered index will alleviate a bookmark lookup and be the fastest way to
access the row.

--
Andrew J. Kelly SQL MVP
Solid Quality Mentors


"Emil" <emil.chirambattu (AT) gmail (DOT) com> wrote

Quote:
is there an advantage in using WITH INDEX in select statement when
PK_ID is a clustered index , will this speed up the process?

SELECT xml FROM FTUS.dbo.data with(nolock, index(PK_ID)) WHERE ID =
200

Eli


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.