auto_explain makes CREATE EXTENSION unusable

From: Sandro Santilli <strk(at)keybit(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: auto_explain makes CREATE EXTENSION unusable
Date: 2014-11-18 11:38:34
Message-ID: 20141118113834.GB8195@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Running 'CREATE EXTENSION postgis' on my machine after enabling
auto_explain results in the process writing gigabytes of logs
keeping the CPU busy for tens of minutes.

RhodiumToad on IRC explained to me:

< RhodiumToad> the extension script code doesn't split the script
into statements itself, it passes the whole thing to the
raw parser and gets back a list of statements

As a result, each INSERT statement found in the PostGIS extension script
results in the whole extension script (including copyright notices!)
being dumped in the logs ("Query Text:").

It is also impossible to know which actual statement the plan refers
to as always the same full script is dumped.

PostGIS has ~4k INSERT statements in its extension script.
While the CREATE EXTENSION statement would take under one second to
complete with auto_explain disabled, here's the state of my machine
at this very moment, with auto_explain enabled:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
8905 strk 20 0 4637680 186348 62448 R 99.5 1.1 14:41.26 postgres: strk dbtopo [local] CREATE EXTENSION

-rw------- 1 strk strk 10228477364 Nov 18 12:37 /tmp/pg93.log

It's been running for almost 15 minutes now, and filling up the logfile.

Could this be considered a bug in auto_explain ?

--strk;

() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html

Browse pgsql-bugs by date

  From Date Subject
Next Message kunert 2014-11-18 17:11:26 BUG #12000: "CROSS JOIN" not equivalent to ","
Previous Message John R Pierce 2014-11-18 08:13:53 Re: BUG #11948: Error when installing PostgreSQL 9.3 server