On Fri, Oct 2, 2015 at 3:57 PM, Peter Geoghegan <p...@heroku.com> wrote: > The spinlock acquisition above is actually necessary despite the > n_writers trick, because that's only used by qtext_store().
Actually, isn't that another bug? The fact that we don't do the same from within gc_qtexts() in normal cases, even with an exclusive lock held? We do this: /* Reset the shared extent pointer */ pgss->extent = extent; I saw one really weird case on a customer database, with an enormous although totally repetitive query text and one entry total (I mentioned this in passing up-thread). Although I'd be willing to believe it was just a very odd use of the database, since apparently they were doing some kind of stress-test, perhaps it could be better explained by a bug like this. To recap, for other people: pg_stat_statements_internal() may do this without any shared lock held: /* No point in loading file now if there are active writers */ if (n_writers == 0) qbuffer = qtext_load_file(&qbuffer_size); -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers