Re: Table count option
| От | Dave Page |
|---|---|
| Тема | Re: Table count option |
| Дата | |
| Msg-id | 455B8CF1.2030400@postgresql.org обсуждение исходный текст |
| Ответ на | Table count option ("Melvin Davidson" <mdavidson@cctus.com>) |
| Список | pgadmin-support |
Melvin Davidson wrote:
> OK, one more time.
>
> Yes I know that right click count does that!
>
> I know about select count(*).
> I know about Right-click -> Count
>
> The question was/is "What is the equivalent SQL function to update the
> Rows(counted) value?
Right, one more time :-)
There is no SQL function. It just does a SELECT count(*) and updates the
value stored in memory (in the pgTable object to be precise).
> IOW, What is the underlying code in Right-click -> Count?
Ultimately, once you get clear of all the menu handling code you get to:
void pgTable::UpdateRows()
{ pgSet *props = ExecuteSet(wxT("SELECT count(*) AS rows FROM ONLY ")
+ GetQuotedFullIdentifier()); if (props) { rows = props->GetLongLong(0); delete props;
rowsCounted= true; }
}
pgTable.rows contains the row count.
pgTable.rowsCounted is a flag that indicates that a count has been done,
rather than an estimate made (estimates come from pg_class.reltuples,
which is populated by ANALYZE).
Regards, Dave
В списке pgadmin-support по дате отправления: