Re: Performance penalty when using WITH

From: Robert Klemme <shortcutter(at)googlemail(dot)com>
To: Li Jin <ljin(at)tripadvisor(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Performance penalty when using WITH
Date: 2011-08-03 16:15:18
Message-ID: CAM9pMnPkFrubkrxWF1+tmJ7vWadxS2LP_i9d9VO-GuEmPsL4oQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Wed, Aug 3, 2011 at 3:27 PM, Li Jin <ljin(at)tripadvisor(dot)com> wrote:
> Robert,
> I've built an index on this expression firstname || ' ' ||
> substring(lastname,1,1). I believe this is the best index for this
> particular query. Correct me if I am wrong.

Maybe, maybe not. Difficult to tell from a distance. I would have an
index on (firstname, lastname). You could try that and look at the
plan for the other query. That's the only ultimate test which will
give you hard facts.

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Merlin Moncure 2011-08-03 16:24:09 Re: Performance penalty when using WITH
Previous Message Robert Ayrapetyan 2011-08-03 14:39:16 Re: Performance die when COPYing to table with bigint PK