Skip site navigation (1) Skip section navigation (2)

Re: Wrong query plan when using a left outer join

From: Rosser Schwarz <rosser(dot)schwarz(at)gmail(dot)com>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
Cc: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Wrong query plan when using a left outer join
Date: 2012-01-17 19:13:45
Message-ID: CAFnxYwj=cBL2+TUfJt1o4_2aPJ=+et2OdrKGxgoTxq8-Jso6Ew@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-sql
2012/1/17 Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>:

> postgres will still try to choose best execution plan. seq scan may simply be
> faster here. breaking point is somewhere near 50% selectivity.

The tipping point is usually far lower than that; in fact, it's more
often around 10%.  Random IO is *very* expensive, as compared to
sequential IO (at least on spinning rust; SSDs are a different matter,
of course).  It's usually vastly cheaper to read in an entire table
and filter the rows you want than to seek left and right (and then
left, left, and right again) to cherry-pick the pages you need.

rls

-- 
:wq

In response to

pgsql-sql by date

Next:From: Samuel GendlerDate: 2012-01-18 07:22:13
Subject: Re: UPDATE COMPATIBILITY
Previous:From: Feike SteenbergenDate: 2012-01-17 18:55:55
Subject: Re: Wrong query plan when using a left outer join

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group