Is the attribute options cache actually worth anything?

Started by Tom Laneabout 15 years ago4 messageshackers
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

So while poking at a recent example from Marc Cousin (hundreds of tables
each with 1000 attributes) I observed that a simple ANALYZE would bloat
the backend process to the tune of several hundred megabytes. I think
there is a leak in CacheMemoryContext, but haven't tracked it down yet.
But I also noticed that tens of megabytes were disappearing into "Attopt
cache", and after reading the code to see what the heck that was, I am
wondering what the justification for having it is at all. In the
presumably normal case where the attribute hasn't got options, all it's
saving us is a syscache access, which is probably not noticeably more
expensive than the hash lookup. In the case where there is an option,
it's saving us an attribute_reloptions() call, but it's not apparent
to me that that's so expensive as to justify putting a cache in front
of it, especially not if we're going to do a palloc cycle anyway.

Did anybody do any performance measurements to demonstrate that this
code has a reason to live? Because if I don't see some, I'm going
to rip it out.

regards, tom lane

#2Robert Haas
robertmhaas@gmail.com
In reply to: Tom Lane (#1)
Re: Is the attribute options cache actually worth anything?

On Tue, Mar 1, 2011 at 1:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Did anybody do any performance measurements to demonstrate that this
code has a reason to live?  Because if I don't see some, I'm going
to rip it out.

No, I have to admit I didn't do that. Might be worth doing some
before you commit the rip-out, though.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#1)
Re: Is the attribute options cache actually worth anything?

Tom Lane wrote:

So while poking at a recent example from Marc Cousin (hundreds of tables
each with 1000 attributes) I observed that a simple ANALYZE would bloat
the backend process to the tune of several hundred megabytes. I think
there is a leak in CacheMemoryContext, but haven't tracked it down yet.
But I also noticed that tens of megabytes were disappearing into "Attopt
cache", and after reading the code to see what the heck that was, I am
wondering what the justification for having it is at all. In the
presumably normal case where the attribute hasn't got options, all it's
saving us is a syscache access, which is probably not noticeably more
expensive than the hash lookup. In the case where there is an option,
it's saving us an attribute_reloptions() call, but it's not apparent
to me that that's so expensive as to justify putting a cache in front
of it, especially not if we're going to do a palloc cycle anyway.

Did anybody do any performance measurements to demonstrate that this
code has a reason to live? Because if I don't see some, I'm going
to rip it out.

Did we decide to keep the cache in attoptcache.c? Is this a TODO?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: Is the attribute options cache actually worth anything?

Bruce Momjian <bruce@momjian.us> writes:

Tom Lane wrote:

Did anybody do any performance measurements to demonstrate that this
code has a reason to live? Because if I don't see some, I'm going
to rip it out.

Did we decide to keep the cache in attoptcache.c? Is this a TODO?

It's still a TODO, I think --- the code's still there, and nobody's done
any performance measurements either way.

regards, tom lane