Re: PATCH: tracking temp files in pg_stat_database

From: "Tomas Vondra" <tv(at)fuzzy(dot)cz>
To: "Magnus Hagander" <magnus(at)hagander(dot)net>
Cc: "Tomas Vondra" <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PATCH: tracking temp files in pg_stat_database
Date: 2012-01-21 17:02:01
Message-ID: fa14c8b265994d0879685b3cd0d8877c.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20 Leden 2012, 13:23, Magnus Hagander wrote:
> On Tue, Jan 17, 2012 at 21:39, Tomas Vondra <tv(at)fuzzy(dot)cz> wrote:
>> On 20.12.2011 19:59, Tomas Vondra wrote:
>>> On 20.12.2011 11:20, Magnus Hagander wrote:
>>>> 2011/12/20 Tomas Vondra <tv(at)fuzzy(dot)cz>:
>>>>>
>>>>> I haven't updated the docs yet - let's see if the patch is acceptable
>>>>> at
>>>>> all first.
>>>>
>>>> Again, without having reviewed the code, this looks like a feature
>>>> we'd want, so please add some docs, and then submit it for the next
>>>> commitfest!
>>>
>>> I've added the docs (see the attachment) and rebased to current head.
>>>
>>> Tomas
>>
>> Fixed a failing regression test (check of pg_stat_database structure).
>
> I'm wondering if this (and also my deadlocks stats patch that's int he
> queue) should instead of inventing new pgstats messages, add fields to
> the tabstat message. It sounds like that one is just for tables, but
> it's already the one collecting info about commits and rollbacks, and
> it's already sent on every commit.

Hmmm, I'm not against that, but I'd recommend changing the message name to
something that reflects the reality. If it's not just about table
statistics, it should not be named 'tabstats' IMHO. Or maybe split that
into two messages, both sent at the commit time.

I do like the idea of not sending the message for each temp file, though.
One thing that worries me are long running transactions (think about a
batch process that runs for several hours within a single transaction). By
sending the data only at the commit, such transactions would not be
accounted properly. So I'd suggest sending the message either at commit
time or after collecting enough data (increment a counter whenever the
struct is updated and send a message when the counter >= N for a
reasonable value of N, say 20). But maybe it already works that way - I
haven't checked the current 'tabstat' implementation.

> Adding two fields to that one would add some extra bytes on every
> send, but I wonder if that woudl ever affect performance, given the
> total size of the packet? And it would certainly be lower overhead in
> the cases that there *have* been temp tables used.

It's not about temp tables, it's about temp files. Which IMHO implies that
there would be exactly 0.000001% performance difference because temporary
files are quite expensive.

Tomas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-01-21 17:13:23 Re: PATCH: tracking temp files in pg_stat_database
Previous Message Robert Haas 2012-01-21 17:00:26 Re: [v9.2] LEAKPROOF attribute of FUNCTION (Re: [v9.2] Fix Leaky View Problem)