Re: Suboptimal query plan when using expensive BCRYPT functions - Mailing list pgsql-performance

From Heikki Linnakangas
Subject Re: Suboptimal query plan when using expensive BCRYPT functions
Date
Msg-id 532FD9FE.9000501@vmware.com
Whole thread Raw
In response to Suboptimal query plan when using expensive BCRYPT functions  (Erik van Zijst <erik.van.zijst@gmail.com>)
Responses Re: Suboptimal query plan when using expensive BCRYPT functions
List 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


pgsql-performance by date:

Previous
From: Erik van Zijst
Date:
Subject: Re: Suboptimal query plan when using expensive BCRYPT functions
Next
From: Brett Wooldridge
Date:
Subject: Connection pooling - Number of connections