hack-instrument-entry-alloc-and-dealloc.patch
text/x-diff
Filename: hack-instrument-entry-alloc-and-dealloc.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| contrib/pg_stat_statements/pg_stat_statements.c | 6 | 0 |
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index 6f62a531f7..ffdc14a1eb 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -1373,6 +1373,10 @@ pgss_store(const char *query, uint64 queryId,
if (!stored)
goto done;
+ elog(LOG, "calling entry_alloc for '%.40s', cur hash size %ld",
+ norm_query ? norm_query : query,
+ hash_get_num_entries(pgss_hash));
+
/* OK to create a new hashtable entry */
entry = entry_alloc(&key, query_offset, query_len, encoding,
jstate != NULL);
@@ -2160,6 +2164,8 @@ entry_dealloc(void)
nvictims = Max(10, i * USAGE_DEALLOC_PERCENT / 100);
nvictims = Min(nvictims, i);
+ elog(LOG, "entry_dealloc: zapping %d of %d victims", nvictims, i);
+
for (i = 0; i < nvictims; i++)
{
hash_search(pgss_hash, &entries[i]->key, HASH_REMOVE, NULL);