> 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)
