Re: BUG #4913: Row missing from primary key index

From: Mathieu De Zutter <mathieu(at)dezutter(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4913: Row missing from primary key index
Date: 2009-07-10 13:49:12
Message-ID: d4468d970907100649g609702c6kb032ab8ef99173d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jul 10, 2009 at 2:02 AM, Alvaro Herrera
<alvherre(at)commandprompt(dot)com>wrote:

> What do the INSERT lines look like? Is it a trigger, an insert called
> directly by the application? How is the sequence involved -- lastval(),
> nextval(), does the code just leave the column out for the default to fire?
>
>

* This is the INSERT query, called from PHP/Apache

INSERT INTO log_event (user_id, ip, action_id, object1_id, object2_id,
event_timestamp)
VALUES ($1, $2, $3, $4, $5, NOW())

So the timestamp is generated by NOW(), and the pkey is generated by using
the default value (nextval).

* There are no UPDATE queries.

* There a few DELETE queries that are lauched daily (called from PHP/cron)

DELETE FROM log_event WHERE action_id = $1 AND event_timestamp < NOW() - '1
month'::interval

(some events are not worthy of archiving individually, we just keep totals)

Regards,
Mathieu

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-07-10 15:03:17 Re: BUG #4913: Row missing from primary key index
Previous Message Pavel Stehule 2009-07-10 04:26:06 Re: BUG #4907: stored procedures and changed tables