Re: md5 function - Mailing list pgsql-general

From Doug McNaught
Subject Re: md5 function
Date
Msg-id 87fzfjjxw4.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Re: md5 function  (Jon Earle <je_pgsql@kronos.honk.org>)
List pgsql-general
Jon Earle <je_pgsql@kronos.honk.org> writes:

> Is there a way to, when I add a record to a table, have the md5 hash
> computed and stored in the same table and then returned to the calling
> program?  Currently, I'm using the perl md5 function to compute the hash
> and store it in the DB but I'm thinking that offloading this to the DB
> itself might be faster (of course, if that's not true and the way I'm
> doing things now is fine, then I'll leave it as it is).

If your webserver is heavily loaded and the DB server isn't too busy,
this might be a win; otherwise it's unlikely to make any difference.
I think perl calls out to C to do the md5 computation, so it's just as
fast as the version in Postgres.

That said, the way to do it if you wanted to would be to write an
insert_my_record() function that stores the data for the record and
returns the md5 hash.

-Doug

pgsql-general by date:

Previous
From: Paul Thomas
Date:
Subject: Re: partial upgradation from 7.1.3 to 7.4
Next
From: "Bob Powell"
Date:
Subject: Excel, OpenOffice and Postgres