[Babase] new tables row count_last modified
Karl O. Pinc
kop at meme.com
Fri Oct 19 12:17:33 EDT 2007
On 10/18/2007 01:17:27 PM, kfenn wrote:
> Two questions for Karl,
>
> Why is it that any new tables we create in the fecal schema do not
> have a row count? I don't think it is just this schema, I think the
> undergrads noticed this problem in their own schemas as well.
The row count is only an estimate used by the planner to make
queries faster. It is updated only when the VACUUM command is
run (on the table or the database as a whole), either manually
or automatically.
I wasn't thinking of the user's tables. I need to turn on
automatic vacuuming so that queries on big tables run (much)
faster.
Note that because the database is multi-user there is
a complex notion of how many rows are in a table. Each
logged-in user has his own "window" into each table,
and sees only what they have done plus what everybody
else has committed. If you "select count(*) from biograph;"
you will get, say, 700 rows. But Lacey might already have
started a transaction and have inserted 2 new rows. If she
does "select count(*) from biograph;" she will get 702 rows.
You will only see those extra 2 rows (in any fashion) when
she commits her transaction. If she rolls it back, or never
commits it, then you will never know she inserted those 2 rows.
> Also, how do we tell when a table was last updated? I used to look
> at the .dbf file dates in in an explorer window for Foxpro, but I'm
> not sure how to check the modified dates on these tables.
As far as I know there is no way to tell. (From the discussion of
transactions above you can see why the answer might not be simple.)
Karl <kop at meme.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein
More information about the Babase
mailing list