mirror of
https://github.com/zebrajr/postgres.git
synced 2025-12-07 00:20:24 +01:00
A single PGSS entry's spinlock is used to be able to modify "counters" without holding pgss->lock exclusively, as mentioned at the top of pg_stat_statements.c and within pgssEntry. Within a single pgssEntry, stats_since and minmax_stats_since are never modified without holding pgss->lock exclusively, so there is no need to hold an entry's spinlock when reading stats_since and minmax_stats_since, as done when scanning all the PGSS entries for function calls of pg_stat_statements(). This also restores the consistency between the code and the comments about the entry's spinlock usage. This change is a performance improvement (it can be argued that this is a logic bug), so there is no need for a backpatch. This saves two instructions from being read while holding an entry's spinlock. Author: Karina Litskevich Reviewed-by: Michael Paquier, wenhui qiu Discussion: https://postgr.es/m/CACiT8ibhCmzbcOxM0v4pRLH3abk-95LPkt7_uC2JMP+miPjxsg@mail.gmail.com |
||
|---|---|---|
| .. | ||
| expected | ||
| sql | ||
| t | ||
| .gitignore | ||
| Makefile | ||
| meson.build | ||
| pg_stat_statements--1.1--1.2.sql | ||
| pg_stat_statements--1.2--1.3.sql | ||
| pg_stat_statements--1.3--1.4.sql | ||
| pg_stat_statements--1.4--1.5.sql | ||
| pg_stat_statements--1.4.sql | ||
| pg_stat_statements--1.5--1.6.sql | ||
| pg_stat_statements--1.6--1.7.sql | ||
| pg_stat_statements--1.7--1.8.sql | ||
| pg_stat_statements--1.8--1.9.sql | ||
| pg_stat_statements--1.9--1.10.sql | ||
| pg_stat_statements--1.10--1.11.sql | ||
| pg_stat_statements--1.11--1.12.sql | ||
| pg_stat_statements--1.0--1.1.sql | ||
| pg_stat_statements.c | ||
| pg_stat_statements.conf | ||
| pg_stat_statements.control | ||