How can i get the total rows of a table:
If i use "select count(*) from <tablename>" it will take lot of time to get the total row count.
for example in MSSQL we have "SELECT ROWS FROM sysindexes WHERE id = OBJECT_ID(<Table name>) AND indid < 2"
I am looking some system index tables which hold the total rows as a statistic values of the table so that i can query that table to get the total rows faster.
My search observations:
I refered this URL: PostgreSQL: Documentation: Manuals: PostgreSQL 8.3: The Statistics Collector
we have "pg_stat_all_tables" it says that this table holds the number of rows information. But when i actually opened that table in the PGAdmin and looked into the columns of that table i did not find any of the columns to hold the Total rows.
I also found that if we select a table in PGAdmin we get the properties in the right side pane, in that we have "rows (counted)" value. But i dont knwo how to retrieve that properties values.
Can any one help me in getting the total rows of the table.
Thanks