pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shaun Thomas <sthomas@optionshouse.com>
To: Claudio Freire <klaussfreire@gmail.com>
To: AJ Weber <aweber@comcast.net>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: how to improve perf of 131MM row table?
Date: Thu, 26 Jun 2014 11:23:54 -0500
Message-ID: <53AC491A.8090207@optionshouse.com> (raw)
In-Reply-To: <CAGTBQpZWsKF=Qjf_nrhoxGDhSda-G0HnRgRvwAZp12ENcEK-5g@mail.gmail.com>
References: <53AB2CB1.8080201@comcast.net>
	<53AB35CC.10202@optionshouse.com>
	<1801a5d4-c3f1-4c0c-9c2c-ffb9d7f723a3@email.android.com>
	<53AB4551.4070207@optionshouse.com>
	<53AC1F6E.4000700@comcast.net>
	<CAGTBQpZNueaUF8=ZZRZW+v4o5Vfdg0ssJdqgT_sMnH7R0JfqZg@mail.gmail.com>
	<53AC3E8D.8040106@comcast.net>
	<53AC40CB.9020006@comcast.net>
	<CAGTBQpZWsKF=Qjf_nrhoxGDhSda-G0HnRgRvwAZp12ENcEK-5g@mail.gmail.com>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 06/26/2014 11:19 AM, Claudio Freire wrote:

> Try changing node_id in (...) into node.id in (...)

Wow. How did we not see that earlier? That's probably the issue. If you 
look at the estimates of his query:

Bitmap Heap Scan on alf_node_properties prop  (cost=1253.19..189491.87 
rows=52790 width=179) (actual time=0.571..1.349 rows=1071 loops=1)

The planner is off by an order of magnitude, and since the matches are 
against node_id instead of node.id, it thinks it would have to index 
seek on the alf_node table for over 50k rows. I could easily see it 
opting for a sequence scan in that case, depending on how high 
random_page_cost is.

-- 
Shaun Thomas
OptionsHouse, LLC | 141 W. Jackson Blvd. | Suite 800 | Chicago IL, 60604
312-676-8870
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (25+ messages)  latest in thread

Message-ID: <53AC491A.8090207@optionshouse.com>
Permalink:  ../53AC491A.8090207@optionshouse.com/
Also on:    postgresql.org/message-id/53AC491A.8090207@optionshouse.com

 · 

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: sthomas@optionshouse.com, klaussfreire@gmail.com, aweber@comcast.net
  Subject: Re: how to improve perf of 131MM row table?
  In-Reply-To: <53AC491A.8090207@optionshouse.com>

* 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