On Fri, Oct 10, 2003 at 04:30:20PM -0000, greg@turnstep.com wrote:
> One way to speed things up is to convert the entire checksum. Consider
> what a md5 checksum really is: a text string representing a hexadecimal
> number. Storing it as TEXT or CHAR is not as good as storing it as a
> number directly. Have your application convert it to a decimal number,
> and then store the checksum as type NUMERIC in the database.
A subsequent idea is that with NUMERIC or other variable length fields
you are wasting time, space and cache hits anyway. It would be probably
faster to create a custom datatype, with fixed length for the exact size
of an MD5 sum. With suitable input and output functions and all the
operators you need, you will likely gain some additional performance
boost.
IIRC, Manfred Koizar developed a fixed-width char datatype for Shridar
Daitankhar (sp?) maybe a year ago. It is probably a good starting
point. Look for it in the pgsql-performance archives.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Endurecerse, pero jamás perder la ternura" (E. Guevara)