Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 83F8E9FB6B8 for ; Mon, 25 Jun 2007 21:33:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 37011-10 for ; Mon, 25 Jun 2007 21:33:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tamriel.snowman.net (tamriel.snowman.net [72.66.115.51]) by postgresql.org (Postfix) with ESMTP id 637D99FB693 for ; Mon, 25 Jun 2007 21:33:41 -0300 (ADT) Received: by tamriel.snowman.net (Postfix, from userid 1000) id EA40E8428D; Mon, 25 Jun 2007 20:33:39 -0400 (EDT) Date: Mon, 25 Jun 2007 20:33:39 -0400 From: Stephen Frost To: Ed Tyrrill Cc: Tom Lane , pgsql-performance@postgresql.org Subject: Re: Message-ID: <20070626003339.GH7531@tamriel.snowman.net> Mail-Followup-To: Ed Tyrrill , Tom Lane , pgsql-performance@postgresql.org References: <7008.1182809415@sss.pgh.pa.us> <1182816598.6477.31.camel@nickel.avamar.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aDKukjHEfhu1+b5Q" Content-Disposition: inline In-Reply-To: <1182816598.6477.31.camel@nickel.avamar.com> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.6.18-4-vserver-amd64 (x86_64) X-Uptime: 20:30:22 up 49 days, 20:43, 24 users, load average: 0.17, 0.17, 0.12 User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/594 X-Sequence-Number: 25627 --aDKukjHEfhu1+b5Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * Ed Tyrrill (tyrrill_ed@emc.com) wrote: > It seems to me that the first plan is the optimal one for this case, but > when the planner has more information about the table it chooses not to > use it. Do you think that if work_mem were higher it might choose the > first plan again? Seems likely to me. You understand that you can set the work_mem whenever you want, right? It's a GUC, so you could issue a 'set work_mem = blah' in the application code right before and right after (assuming you're going to continue using the session) this particular query, or just do it in a seperate session using 'explain' to play around with what the planner does given different arguments. 'explain's pretty cheap/easy, and you can play around with various settings to see what PG will do in various cases. Of course, you won't know the runtimes without doing 'explain analyze', but I think you have a good idea of the best plan for this query already... Thanks, Stephen --aDKukjHEfhu1+b5Q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGgF7jrzgMPqB3kigRAglAAJ9ZNsv5rgl2Xbz0l6cXTFS1AuysfwCdGJAF vwPT8pPPqpuO4Z7CDPf7JVY= =j2ij -----END PGP SIGNATURE----- --aDKukjHEfhu1+b5Q--