Re: Number of rows of a table

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: vittorio <vdemart1(at)tin(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Number of rows of a table
Date: 2005-10-18 23:23:35
Message-ID: ED3BE54F-E84A-49A0-B984-BD7233200174@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Oct 19, 2005, at 2:29 , vittorio wrote:

> Using psql how can I ask postgresql to show the actual number of
> rows of a
> table?

For table foo,

select count(*) from foo;

An up-to-date count of the number of actual rows is not stored some
place in the database. If an estimate is adequate for your purposes,
you might want to look at some of the system tables which track row
counts for query planning strategy. I don't recall offhand which
column of which system table you'd want to look at, unfortunately.

Michael Glaesemann
grzm myrealbox com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2005-10-18 23:30:41 Re: Number of rows of a table
Previous Message Michael Glaesemann 2005-10-18 23:19:37 Re: Wrong charset?