From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> |
Cc: | Decibel! <decibel(at)decibel(dot)org>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: contrib/pg_stat_statements |
Date: | 2008-10-16 01:23:36 |
Message-ID: | 20081016012336.GK6012@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
ITAGAKI Takahiro wrote:
> We need to avoid using normal UPDATEs to increment counters
> because it requires row-level exclusive locks and kills concurrency.
> My idea was modifying heap tuples directly in pages:
>
> buffer = ReadBuffer(stats_rel, blknum);
> LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
> htup = PageGetItem(BufferGetPage(buffer), itemid);
> statobj = ((char *) htup + htup->t_hoff);
> statobj->calls++;
> LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
>
> It seemed to work in my test, but of course it is too dangerous.
> (If we had supported ISAM-like storage engine, we might use it here.)
heap_inplace_update?
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | ITAGAKI Takahiro | 2008-10-16 01:33:20 | Re: contrib/pg_stat_statements |
Previous Message | ITAGAKI Takahiro | 2008-10-16 01:14:08 | Re: contrib/pg_stat_statements |