SELECT 1 VS Select *

Connor Cunningham has a great explanation of the difference between using SELECT 1 versus SELECT * in an EXISTS clause.  I’d like to add that I’m assuming that the same rule would apply to SELECT count(*) and SELECT count(1).

SQL Query Optimizer would expand * into the column list and then figure out that none of them are needed.  So theoretically, SELECT count(1) would be a little faster in putting the plan together, but would run at the same speed and have the same IOs as SELECT count(*).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: