GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Database  >  Sybase
Go To First  |  Previous Question  |  Next Question 
 Sybase  |  Question 2 of 64    Print  
Which one is faster count(*) or count(1) ?

  
Total Answers and Comments: 4 Last Update: June 23, 2009     Asked by: Rajesh 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 14, 2006 11:49:41   #1  
Pat        

RE: which one is faster count(*) or count(1) ??
I've always believed count(1) was faster as it doesn't have to return all columns just the row identity. But logically speaking the optimiser should take care of that so they should translate into the same underlying code
 
Is this answer useful? Yes | No
May 09, 2008 06:57:58   #2  
Rashmi121 Member Since: May 2008   Contribution: 2    

RE:
count (1) is faster than count(*) because count(*) returns all the rows as given in the select stmt including duplicate and null values while count(1) or count(expr) will return all non-null values in column 1.
 
Is this answer useful? Yes | No
June 14, 2008 01:57:04   #3  
tumeshk Member Since: June 2008   Contribution: 2    

RE: Which one is faster count(*) or count(1) ?
count(1) will be faster than count(*) because it counts the first column values with not null
 
Is this answer useful? Yes | No
June 23, 2009 12:17:09   #4  
gcvpgeek Member Since: March 2009   Contribution: 9    

RE: Which one is faster count(*) or count(1) ?
count(1) is faster than count(*)
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape