Re: Optimizing query: select ... where id = 4 and md5(...) - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Optimizing query: select ... where id = 4 and md5(...)
Date
Msg-id 44A93D4E.5020808@magproductions.nl
Whole thread Raw
In response to Optimizing query: select ... where id = 4 and md5(...) = '...'  ("Alexander Farber" <alexander.farber@gmail.com>)
Responses Re: Optimizing query: select ... where id = 4 and md5(...) = '...'  ("Alexander Farber" <alexander.farber@gmail.com>)
List pgsql-general
Alexander Farber wrote:
> I wonder, what is faster: fetching 2 columns - the
> username and the md5-result and then comparing the
> md5 string against the argument in my app, like here:
>
> punbb=> select username, md5('deadbeef' || password) from users where id
> = 4;
> username |               md5
> ----------+----------------------------------
> Vasja    | dcde745cc304742e26d62e683a9ecb0a
> (1 row)

Why don't you store the hashed value instead?

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: pgsql vs mysql - escaping data for COPY?
Next
From: Vivek Khera
Date:
Subject: Re: pgsql user change to postgres