From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Erik van Zijst <erik.van.zijst@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Suboptimal query plan when using expensive BCRYPT functions
Date: Mon, 24 Mar 2014 09:08:46 +0200
Message-ID: <532FD9FE.9000501@vmware.com> (raw)
In-Reply-To: <CA+69USsLsVb8U5=r7KYs9GYT4Rx9DtyaohsfHvLzVKS=fZNUEw@mail.gmail.com>
References: <CA+69USsLsVb8U5=r7KYs9GYT4Rx9DtyaohsfHvLzVKS=fZNUEw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: hlinnakangas@vmware.com, erik.van.zijst@gmail.com
Subject: Re: Suboptimal query plan when using expensive BCRYPT functions
In-Reply-To: <532FD9FE.9000501@vmware.com>
* 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