On Thu, Feb 5, 2015 at 8:58 PM, Amit Kapila <amit.kapil...@gmail.com> wrote: > > Currently in pg_stat_statements, the setup to track > instrumentation/totaltime information is done after > ExecutorStart(). Can we do this before ExecutorStart()?
On further analyzing, I found that currently it is done after ExecutorStart() because we want to allocate Instrumentation info in per-query context which is allocated in ExecutorStart(), but I wonder why can't it be done inside ExecutorStart() after per-query context is available. Currently backend (standard_ExecutorRun()) takes care of updating the stats/instrumentation info for a plugin (pg_stat_statements) and the same is initialized by plugin itself, won't it be better that both the operations be done by backend as backend has more knowledge when it is appropriate to initialize or update and plugin needs to just indicate that it needs stats. Does anyone sees problem with doing it in above way or can think of a better way such that this information (that plugin needs stats) can be made available in ExecutorStart phase? With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com