Re: Table count option - Mailing list pgadmin-support
From | Dave Page |
---|---|
Subject | Re: Table count option |
Date | |
Msg-id | [email protected] Whole thread Raw |
In response to | Table count option ("Melvin Davidson" <[email protected]>) |
List | 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 by date: