Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

5 Posts

Posted - 04/23/2013 :  01:04:28  Show Profile  Reply with Quote
Does creating an index on a column remove the inherent advantage of searching a table by its primary key (an ID, for example)?

In other words, say I have a table with 2 columns,

If I do a index on email, will the command

SELECT email FROM table WHERE id = 1231

run any slower than if I don't index email? Does SQL keep a sorted copy of the table sorted by the index, or does it actually sort the original?

I am using Mysql and/or postgres if it makes a difference.


Aged Yak Warrior

737 Posts

Posted - 04/23/2013 :  01:19:58  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
Please post this in mysql or postgres forums..this is a sql server related forum.
not sure if the database indexing architechture for all these is same.
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 04/23/2013 :  12:47:00  Show Profile  Reply with Quote
In sql server it depends on what column query engine uses. The retrieval performance has no direct relationship with number of indexes present. However any DML operation on the table might get slower on addition of new indexes.
The query analyser will just see whats the easiest way of finding record based on search fields used. Based on it, it may choose to traverse the actual table (or clustered index if present) or traverse the nonclustered index table.

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000