473,378 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Nubbin question :(

create table guidtest(a int primary key clustered, b uniqueidentifier,
c varchar(200))

insert into guidtest values (1, newid(), 'ashakhfoagfoahfafdsa')
insert into guidtest values (45, newid(), 'EWRYEYYTURJ')
insert into guidtest values (231, newid(), 'WYEW')
insert into guidtest values (73573, newid(),
'ashakhgs\YEW5Yfoagfoahfafdsa')
insert into guidtest values (463784, newid(),
'ashakhfoagDGHHDDfoahfafdsa')
insert into guidtest values (416571371, newid(),
'ashakXHSDFSGRSRhfoagfoahfafdsa')
select * from guidtest where b =
'9EE19242-5C78-4520-9F0A-365A42237BB0'

select * from guidtest where c = 'ashakhfoagDGHHDDfoahfafdsa'

Query plans for the 2 queries show pk scan.

My sarg isn't on the pk. Am I just being a nub?
Jul 20 '05 #1
1 1199
Hello, primary key scan, is another way of saying clustered index scan, or
simply clustered table scan. Since you have clustered index there, table
scan = clustered index scan. Saying all that , whether optimazer will pick
index or scan also depends also on size of the table. In your case table is
small , fits on one page, 2 pages when has index. So scan of the table I/O
costs is 1 page, when using index 2 pages. Better to scan in this particular
case :)). But, in general it all depends on cost analysis that are done by
optimazer.

cheers,

Lucjan

"WangKhar" <Wa******@yahoo.com> wrote in message
news:bb**************************@posting.google.c om...
create table guidtest(a int primary key clustered, b uniqueidentifier,
c varchar(200))

insert into guidtest values (1, newid(), 'ashakhfoagfoahfafdsa')
insert into guidtest values (45, newid(), 'EWRYEYYTURJ')
insert into guidtest values (231, newid(), 'WYEW')
insert into guidtest values (73573, newid(),
'ashakhgs\YEW5Yfoagfoahfafdsa')
insert into guidtest values (463784, newid(),
'ashakhfoagDGHHDDfoahfafdsa')
insert into guidtest values (416571371, newid(),
'ashakXHSDFSGRSRhfoagfoahfafdsa')
select * from guidtest where b =
'9EE19242-5C78-4520-9F0A-365A42237BB0'

select * from guidtest where c = 'ashakhfoagDGHHDDfoahfafdsa'

Query plans for the 2 queries show pk scan.

My sarg isn't on the pk. Am I just being a nub?

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
Atli
by: Atli | last post by:
Hi. I've created this little window that is shown when I roll the mouse over elements I specify in my html code. Like a nubbin I test this in IE while I'me writing it, thinking it can hardly be...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.