pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: zotov@oe-it.ru
To: pgsql-performance@postgresql.org
Subject: Re: Bad plan when join on function
Date: Mon, 17 Jan 2011 14:51:24 -0600
Message-ID: <4D34576C02000025000396CB@gw.wicourts.gov> (raw)

Zotov  wrote:
 
> select c.id from OneRow c join abstract a on a.id=AsInteger(c.id)
 
> Why SeqScan???
 
Because you don't have an index on AsInteger(c.id).
 
If your function is IMMUTABLE (each possible combination of input
values always yields the same result), and you declare it such, then
you can index on the function, and it will perform at a speed similar
to the other example.
 
-Kevin



view thread (7+ messages)  latest in thread

Message-ID: <4D34576C02000025000396CB@gw.wicourts.gov>
Permalink:  ../4D34576C02000025000396CB@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4D34576C02000025000396CB@gw.wicourts.gov

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, zotov@oe-it.ru
  Subject: Re: Bad plan when join on function
  In-Reply-To: <4D34576C02000025000396CB@gw.wicourts.gov>
  References: <4D34576C02000025000396CB@gw.wicourts.gov>

* 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