On Tue, Feb 14, 2017 at 09:24:47PM -0800, Joshua Chamberlain wrote:
> Hello,
>
> (I'm posting to hackers since I got no response on the general
> list.)
>
> I use Postgres + PostGIS quite heavily, and recently have been
> taking full advantage of the new parallelism in 9.6. I'm now running
> queries in a few hours that would otherwise take more than a day.
>
> However, parallelism is disabled for all queries that perform writes
> (as documented). I would normally run "CREATE TABLE AS [some
> super-expensive query]", but since that can't use parallelism I'm
> using the \o option in psql, creating the table separately, and then
> \copy-ing in the results. That works, but "CREATE TABLE AS" would
> be more convenient.
How about creating a temp view?
CREATE TEMPORARY VIEW foo_tv AS [your gigantic query goes here];
CREATE TABLE foo (LIKE foo_tv);
INSERT INTO foo SELECT * FROM foo_tv;
> Are there plans in 10.0 to allow parallelism in queries that write,
> or at least in "CREATE TABLE AS" queries? (Support in materialized
> views would be great, too!)
Patches are always welcome, and there's one more commitfest to go
before 10.
Best,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate