zubkov-andrei / pg_profile

Postgres historic workload reports
Other
228 stars 33 forks source link

Data loose when capture pg_stat_stataemnts #96

Closed cwang9208 closed 3 months ago

cwang9208 commented 4 months ago

Hi, I’m just wondering can pg_profile miss some data when capturing pg_stat_statement? I think pg_profile is not able to capture the data inserted right after the extension finishes fetching the statements view but before reset is called. The data inserted in this small period can be lost.

Has pg_profile taken this scenario into consideration?

zubkov-andrei commented 4 months ago

Hello! Obvious, data loss is possible here. We just hope it won't affect the results too much. Right now there is nothing we can do to address this issue, but PostgreSQL 17 will contain pg_stat_statements v1.11 making it possible to track every statement entry timestamp. Using those we can avoid per sample pgss resets or make them happen for example once per 10 samples. Of course this won't totally eliminate the problem but make it less painful.

cwang9208 commented 4 months ago

Noted. Thanks for your reply :)