Qingqing Zhou wrote: > Attached is a draft patch implementing the idea. To play with it, you > shall create the follow two foreign tables: > CREATE EXTENSION file_fdw; > CREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw; > create foreign table pg_planner_rels(rel text, content text)server > pglog options(filename '<your_install>/data/debug_planner_relopt.csv', > format 'csv'); > create foreign table pg_planner_paths(rel text, path text, replacedby > text, reason int, startupcost float, totalcost float, cheapest text, > innerp text, outerp text, content text) server pglog options(filename > '<your_install>/data/debug_planner_paths.csv', format 'csv');
I think this is a pretty neat idea, but I'm not sure this user interface is a good one. Why not have a new option for EXPLAIN, so you would call "EXPLAIN (planner_stuff=on)" and it returns this as a resultset? This idea of creating random CSV files seems odd and inconvenient in the long run. For instance it fails if you have two sessions doing it simultaneously; you could tack the process ID at the end of the file name to prevent that problem, but then the foreign table breaks each time. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers