Re: md5 function

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Jon Earle <je_pgsql(at)kronos(dot)honk(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: md5 function
Date: 2003-12-17 14:56:43
Message-ID: 87fzfjjxw4.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jon Earle <je_pgsql(at)kronos(dot)honk(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-12-17 15:55:29 Re: restore error - language "plperlu" is not trusted
Previous Message Paul Thomas 2003-12-17 14:54:41 Re: partial upgradation from 7.1.3 to 7.4