pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Pierre C <lists@peufeu.com>
To: Scott Marlowe <scott.marlowe@gmail.com>
To: Shaun Thomas <sthomas@peak6.com>
Cc: Craig Ringer <craig@postnewspapers.com.au>
Cc: Aren Cambre <aren@arencambre.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Postgres refusing to use >1 core
Date: Wed, 11 May 2011 20:10:54 +0200
Message-ID: <op.vvbwsgdaeorkce@apollo13> (raw )
In-Reply-To: <4DCAB3A1.2090507@peak6.com >
References: <BANLkTimohiUa6rOYdxYTwqmvSUg2CRYMHg@mail.gmail.com >
<4DC81A3F020000250003D433@gw.wicourts.gov >
<BANLkTimNTLqQgQeyu=FPOn-5x6F4XnVBJA@mail.gmail.com >
<4DC81D56020000250003D438@gw.wicourts.gov >
<BANLkTi=FH4rX-7OtS9ozjuyXQTNTiRqCmg@mail.gmail.com >
<BANLkTinwkj7syvKkYzU_O7DD14EMzk2Zmg@mail.gmail.com >
<BANLkTi=BvGMvsBNq8DUt=_MPJXZjcC0TWg@mail.gmail.com >
<4DC8B893.3060908@postnewspapers.com.au >
<BANLkTimi+2nviLvWU4zKGtG688+Z84DF6w@mail.gmail.com >
<4DC9E7C5.9080309@postnewspapers.com.au >
<BANLkTi=PxROPQFDt1a6N68e_+5_AojagmA@mail.gmail.com >
<4DCAB3A1.2090507@peak6.com >
> This is a problem I encounter constantly wherever I go. Programmer
> selects millions of rows from giant table. Programmer loops through
> results one by one doing some magic on them. Programmer submits queries
> back to the database. Even in batches, that's going to take ages.
Reminds me of a recent question on stackoverflow :
http://stackoverflow.com/questions/5952020/how-to-optimize-painfully-slow-mysql-query-that-finds-cor...
And the answer :
http://stackoverflow.com/questions/5952020/how-to-optimize-painfully-slow-mysql-query-that-finds-cor...
OP was thinking "row-based", with subqueries in the role of "doing some
magicm".
Using a set-based solution with cascading WITH CTEs (and using the
previous CTE as a source in the next one for aggregation) => 100x speedup !
view thread (46+ messages) latest in thread
Message-ID: <op.vvbwsgdaeorkce@apollo13>
Permalink: ../op.vvbwsgdaeorkce@apollo13/
Also on: postgresql.org/message-id/op.vvbwsgdaeorkce@apollo13
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: lists@peufeu.com, scott.marlowe@gmail.com, sthomas@peak6.com, craig@postnewspapers.com.au, aren@arencambre.com
Subject: Re: Postgres refusing to use >1 core
In-Reply-To: <op.vvbwsgdaeorkce@apollo13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox