Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
which is efficient count(*) or count(1) ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Ritesh Chopra

New User


Joined: 15 Oct 2007
Posts: 13
Location: India

PostPosted: Mon Nov 05, 2007 11:19 am    Post subject: which is efficient count(*) or count(1) ?
Reply with quote

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
View user's profile Send private message

vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Mon Nov 05, 2007 11:32 am    Post subject:
Reply with quote

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...... icon_smile.gif
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Mon Nov 05, 2007 11:35 am    Post subject:
Reply with quote

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.......... icon_smile.gif
Back to top
View user's profile Send private message
Ritesh Chopra

New User


Joined: 15 Oct 2007
Posts: 13
Location: India

PostPosted: Mon Nov 05, 2007 11:41 am    Post subject:
Reply with quote

Thanks but can you explain that in more detail.
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Mon Nov 05, 2007 12:47 pm    Post subject:
Reply with quote

Hi Ritesh,

pls find the link below, it is explained practically, it would helpfull for you.


http://justoracle.blogspot.com/2006/12/count-vs-count1.html


Regard's
Vasanth......... icon_smile.gif

"Never Give Up Until U Succeed"
Back to top
View user's profile Send private message
Ritesh Chopra

New User


Joined: 15 Oct 2007
Posts: 13
Location: India

PostPosted: Mon Nov 05, 2007 4:14 pm    Post subject:
Reply with quote

vasanthkumarhb wrote:
Hi Ritesh,

pls find the link below, it is explained practically, it would helpfull for you.


http://justoracle.blogspot.com/2006/12/count-vs-count1.html


Regard's
Vasanth......... icon_smile.gif

"Never Give Up Until U Succeed"


Yap the link has enough details.
Thanks Vasanth.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts CICS Transaction attach count of supp... lind sh CICS 1 Wed Jun 21, 2017 1:33 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us