I wrote:
> > pgstat_drop_relation() is expecting relid (pg_class.oid) as the argument,
> > but we pass it relfilenode.
> I'm trying to fix the bug, because there is a possibility that some useless
> statistics data continue to occupy some parts of the statistics table.
Here is a patch to fix undropped entries in the runtime statistics table.
Now smgr records the relation oids and uses them to drop entries
corresponding the relations.
We could make stray entries easily using the following queries.
CREATE TABLE test (i integer);
INSERT INTO test VALUES(1);
TRUNCATE test;
DROP TABLE test;
Since we don't discard any of stat entries except pg_stat_reset(),
those useless entries would cause memory leaks, though it is very trivial.
I fell my fix is uncool; Let me know if there are any other better ways.
Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center