From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Tomas Vondra <tv(at)fuzzy(dot)cz> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PATCH: tracking temp files in pg_stat_database |
Date: | 2011-12-20 10:20:41 |
Message-ID: | CABUevEyvPpoMPONu36oePkLGvRSEjCioG+D38m=M7mKOp9myQw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2011/12/20 Tomas Vondra <tv(at)fuzzy(dot)cz>:
> Hello everybody,
>
> this patch adds two counters to pg_stat_database to track temporary
> files - number of temp files and number of bytes. I see this as a useful
> feature, as temporary files often cause a lot of IO (because of low
> work_mem etc.). The log_temp_files is useful, but you have to parse the
> log and only temp files exceeding a size limit are logged so the actual
> amount of I/O is unknown.
Hey, cool, that was on my personal TODO list :-)
> The patch is rather simple:
>
> 1) two new fields in PgStat_StatDBEntry (n_temp_files, n_temp_bytes)
> 2) report/recv function in pgstat.c
> 3) FileClose modified to log stats for all temp files (see below)
> 4) two new fields added to pg_stat_database (temp_files, temp_bytes)
I haven't reviewed the code itself yet, but that seems like a
reasonable approach.
> I had to modify FileClose to call stat() on each temp file as this
> should log all temp files (not just when log_temp_file >= 0). But the
> impact of this change should be negligible, considering that the user is
> already using temp files.
>
> 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!
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2011-12-20 10:27:41 | Re: xlog location arithmetic |
Previous Message | Magnus Hagander | 2011-12-20 10:14:23 | Re: JSON for PG 9.2 |