|
View previous topic :: View next topic
|
| Author |
Message |
Ritesh Chopra
New User

Joined: 15 Oct 2007 Posts: 13 Location: India
|
|
|
|
Hi ALL,
please can anybody give me the comparison for count(*) and count(1) in terms of efficiency ? please include a detailed view on how to decide in which situation what is better. |
|
| Back to top |
|
 |
vasanthkumarhb
Active User

Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
As i seen both returns the same answer , but if you want to improve the efficiency you need to have proper CLUSTER INDEX in the query.
Regard's
Vasanth......  |
|
| Back to top |
|
 |
vasanthkumarhb
Active User

Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi,
Adding to the above answer.
I think of count(*) as counting the number of rows but I have heard people liking count(1) as meaning count where the existence of the row is true (1 meaning true).
I think count(1) gives lesser performance over count(*).
Regard's
Vasanth..........  |
|
| Back to top |
|
 |
Ritesh Chopra
New User

Joined: 15 Oct 2007 Posts: 13 Location: India
|
|
|
|
| Thanks but can you explain that in more detail. |
|
| Back to top |
|
 |
vasanthkumarhb
Active User

Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
| Back to top |
|
 |
Ritesh Chopra
New User

Joined: 15 Oct 2007 Posts: 13 Location: India
|
|
|
|
Yap the link has enough details.
Thanks Vasanth. |
|
| Back to top |
|
 |
|
|