Re: Suboptimal query plan when using expensive BCRYPT functions

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Erik van Zijst <erik(dot)van(dot)zijst(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Suboptimal query plan when using expensive BCRYPT functions
Date: 2014-03-24 07:08:46
Message-ID: 532FD9FE.9000501@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 03/22/2014 02:59 AM, Erik van Zijst wrote:
> Is there any way I can get postgres to perform the hash calculations
> on the *result* of the other parts of the where clause, instead of the
> other way around? Or else rewrite the query?

The planner doesn't know that the crypt function is expensive. That can
be fixed with "ALTER FUNCTION crypt(text, text) COST <high value>". Even
with that, I'm not sure if the planner is smart enough to optimize the
query the way you'd want, but it's worth a try.

- Heikki

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Brett Wooldridge 2014-03-24 13:27:10 Connection pooling - Number of connections
Previous Message Erik van Zijst 2014-03-23 18:30:21 Re: Suboptimal query plan when using expensive BCRYPT functions