Home » SQL & PL/SQL » SQL & PL/SQL » What is the difference between these 2 queries
What is the difference between these 2 queries [message #293405] Sat, 12 January 2008 04:08 Go to next message
cgmsuresh
Messages: 29
Registered: December 2007
Location: http://maps.google.com/ma...
Junior Member

What is the difference between these 2 queries
Select count(*) from table
Select count(1) from table


Thanks and Regards,
Suresh.
Re: What is the difference between these 2 queries [message #293406 is a reply to message #293405] Sat, 12 January 2008 04:40 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member

no difference.

LINK

regards,
Re: What is the difference between these 2 queries [message #293412 is a reply to message #293406] Sat, 12 January 2008 06:14 Go to previous messageGo to next message
kir_ait
Messages: 198
Registered: November 2007
Location: Bangalore,India
Senior Member

There is no difference. Search the board for details.

Kiran.
Re: What is the difference between these 2 queries [message #293423 is a reply to message #293412] Sat, 12 January 2008 09:18 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Hopefully you are there to repeat the same answer much less information but more words than the previous one.

Regards
Michel

[Updated on: Sat, 12 January 2008 09:18]

Report message to a moderator

Re: What is the difference between these 2 queries [message #293434 is a reply to message #293423] Sat, 12 January 2008 13:28 Go to previous messageGo to next message
Littlefoot
Messages: 20888
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Also, next time user smaller font to save disk space.
Click here
Re: What is the difference between these 2 queries [message #293442 is a reply to message #293405] Sat, 12 January 2008 19:11 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
hahahahaha!
Re: What is the difference between these 2 queries [message #295788 is a reply to message #293405] Wed, 23 January 2008 07:53 Go to previous messageGo to next message
kir_ait
Messages: 198
Registered: November 2007
Location: Bangalore,India
Senior Member

@Michel,

You are always there to comment on everybody apart from the answering.

And I wonder if that don't consume any disk space!
Re: What is the difference between these 2 queries [message #295791 is a reply to message #295788] Wed, 23 January 2008 07:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Er! What did you do there?

Regards
Michel
Re: What is the difference between these 2 queries [message #295792 is a reply to message #293405] Wed, 23 January 2008 08:06 Go to previous messageGo to next message
ramanajv1968
Messages: 168
Registered: December 2005
Location: HYDERABAD
Senior Member
In the Earlier releases(since you are not mentioned your version)

Since the COUNT function will return the same
results regardless of what NOT NULL field(s)
you include as the COUNT function parameters (ie: within the brackets), you can change the syntax of the COUNT
function to COUNT(1) to get better performance as
the database engine will not have to fetch back
the data fields.

[Updated on: Wed, 23 January 2008 08:15] by Moderator

Report message to a moderator

Re: What is the difference between these 2 queries [message #295793 is a reply to message #295792] Wed, 23 January 2008 08:16 Go to previous message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
you can change the syntax of the COUNT
function to COUNT(1) to get better performance as
the database engine will not have to fetch back
the data fields.

This is plain WRONG.
Oracle does not have to fetch anything to count.
Actually count(1) is internally replaced by count(*).

Regards
Michel
Previous Topic: oracle update
Next Topic: Query Taking Long Time To Fetch the Resultsets
Goto Forum:
  


Current Time: Fri Dec 02 16:39:57 CST 2016

Total time taken to generate the page: 0.55319 seconds