Re: 64-bit queryId?
Greg Stark <stark@mit.edu>
From: Greg Stark <stark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>,
Peter Geoghegan <pg@bowt.ie>, Robert Haas <robertmhaas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2017-10-01T19:48:46Z
Lists: pgsql-hackers
On 1 October 2017 at 16:40, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Greg Stark <stark@mit.edu> writes: >> Indeed. It's simple enough to export stats to prometheus with queryid >> as the key. Then even if the query ages out of the database stats you >> have graphs and derivative metrics going further back. > > I'm not really ready to buy into that as a supported use-case, because > it immediately leads to the conclusion that we need to promise stability > of query IDs across PG versions, which seems entirely infeasible to me > (at least with anything like the current method of deriving them). Well these kinds of monitoring systems tend to be used by operations people who are a lot more practical and a lot less worried about theoretical concerns like that. What they're going to want to do is things like "alert on any query using more than 0.1 cpu core" or "alert on any query being the top i/o consumer that isn't amongst the top 10 over the previous day" or "alert on any query using more than 4x the cpu or i/o on one database than it does on average across all our databases". That last one is a case where it would be nice if the queryid values were stable across versions but it's hardly surprising that they aren't. In context the point was merely that the default pg_stat_statements.max of 5000 isn't sufficient to argue that 32-bit values are enough. It wouldn't be hard for there to be 64k different queries over time and across all the databases in a fleet and at that point it becomes likely there'll be a 32-bit collision. -- greg
Commits
-
pg_stat_statements: Add a comment about the dangers of padding bytes.
- 2959213bf33c 11.0 landed
-
pg_stat_statements: Widen query IDs from 32 bits to 64 bits.
- cff440d36869 11.0 landed