Home » SQL & PL/SQL » SQL & PL/SQL » optimized count
optimized count [message #19249] Wed, 06 March 2002 20:08 Go to next message
Messages: 138
Registered: June 2000
Senior Member
If i have a table with more than a million records.
Is there any better way to get the count of those records without using "Count " Function.

Thanks in advance

Re: optimized count [message #19251 is a reply to message #19249] Wed, 06 March 2002 20:34 Go to previous messageGo to next message
Messages: 101
Registered: August 2000
Senior Member
hi srinivas,
use this query

select max(rownum) from table;
Re: optimized count [message #19266 is a reply to message #19251] Thu, 07 March 2002 09:37 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
select count(*) from t
is the designed, fastest,and best way to get a count of rows in a table.

select max(rownum) from t
is actually a poorer performing alternative to count(*).
Previous Topic: PL/Sqlplus-extracting data from Table to comma delim file
Next Topic: obtaining column name by knowing table name (user created) and a value in that is present in that t
Goto Forum:

Current Time: Wed Oct 20 18:54:36 CDT 2021