Re: [PATCH v5] pg_stat_statements: Add last_execution_start column

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v5] pg_stat_statements: Add last_execution_start column
Date: 2026-06-10 21:32:32
Message-ID: CAA5RZ0uvOwf3TS8Le9BzFZ0iVTkaHBtOW6EECdkdMnP4WinyLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I have one more question: should statements that failed have an
> execution start set?

No, the should not have an execution start set. Any query execution
that fails will not accumulate statistics currently. This is because
the counters are updated on ExecutorEnd.

I do think there could be future work to accumulate some stats on
ExecutorStart; for example calls_started, called_completed instead
of just a calls counter. However the current design of pg_stat_statements
makes the spinlock contention worse. This could become viable once we
redesign pg_stat_statements to remove the SpinLock to update the counters.

--
Sami Imseih
Amazon Web Services (AWS)

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Sami Imseih 2026-06-10 21:22:49 Re: [PATCH v5] pg_stat_statements: Add last_execution_start column