Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread Tom Lane
bricklen writes: > Perhaps someone else will have some other ideas of what could be useful > here. Maybe I'm missing something ... but isn't the OP's query completely bogus? SELECT DISTINCT u.* FROM auth_user u JOIN bb_userprofile p ON p.user_id = u.id JOIN bb_identity i ON i.pro

Re: [PERFORM] Query taking long time

2014-03-22 Thread Venkata Balaji Nagothi
On Thu, Mar 20, 2014 at 9:17 PM, acanada wrote: > Hello, > > New server postgres version is 9.3. I'm not sure if I collected latest > statistics after migration, if you mean if the current_settings or analyze > queries that I posted were collected after migration... yes (notice that > there are a

Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread bricklen
On Sat, Mar 22, 2014 at 8:37 PM, Erik van Zijst wrote: > On Sat, Mar 22, 2014 at 3:56 PM, bricklen wrote: > > On Sat, Mar 22, 2014 at 3:27 PM, Erik van Zijst < > erik.van.zi...@gmail.com> > >> I could nonetheless take a stab at it, but life would certainly be > >> easier if I could translate each

Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread Erik van Zijst
On Sat, Mar 22, 2014 at 3:56 PM, bricklen wrote: > On Sat, Mar 22, 2014 at 3:27 PM, Erik van Zijst >> I could nonetheless take a stab at it, but life would certainly be >> easier if I could translate each component independently and leave >> optimization to the query planner. > > How about encaps

Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread bricklen
On Sat, Mar 22, 2014 at 3:27 PM, Erik van Zijst wrote: > Yes, that works (it does at least on my small test database). > > However, these queries are generated by a parser that translates > complex parse trees from a higher level DSL that doesn't lend itself > well to logically isolating the crypt

Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread Erik van Zijst
Yes, that works (it does at least on my small test database). However, these queries are generated by a parser that translates complex parse trees from a higher level DSL that doesn't lend itself well to logically isolating the crypt checks from the remaining conditions, as password checks might b

Re: [PERFORM] Suboptimal query plan when using expensive BCRYPT functions

2014-03-22 Thread bricklen
On Fri, Mar 21, 2014 at 5:59 PM, Erik van Zijst wrote: > Hi there, > > I've got a relatively simple query that contains expensive BCRYPT > functions that gets optimized in a way that causes postgres to compute > more bcrypt hashes than necessary, thereby dramatically slowing things > down. > > In