How can I count the number of rows in a large table?
Currently executing from SQL Plus:
set transaction use rollback segment r01huge;
select count(rowid) from tablea;
Receive error message:
ORA-01555: snapshot too old: rollback segment number 3 with name "R03" too small
RBS r01huge (size 600m) was not set, used R03 (size 20m).
Last count 224,470,269
What is the best way to count the number of rows in the table?
Are you doing inserts or updates when you run the count?
That could cause the rollback error. You could check you export files if you do a daily export.
I remember reading in a Couchman book that
SELECT COUNT(1) is easier on the database the
SELECT COUNT(*). I can't remember why though, but try it.
SELECT COUNT(1) FROM TABLE_NAME;
I remember when this place was cool.
Click Here to Expand Forum to Full Width