Re: Using bytea field...

From: Andy Colson <andy(at)squeakycode(dot)net>
To: Andre Lopes <lopes80andre(at)gmail(dot)com>
Cc: postgresql Forums <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using bytea field...
Date: 2011-03-08 19:06:43
Message-ID: 4D767E43.2020401@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/8/2011 12:28 PM, Andre Lopes wrote:
> Hi,
>
> I'm using a bytea field to store small images in base64. I need to
> know if I can compare bytea rows for equality. To know for example if
> the file already exists in the database, this is possible with bytea?
>
> Best Regads,
>

You dont need to use both base64 and bytea. You can store base64 in
text field... or just store the photo as-is into bytea.

To answer your question: it would be faster if you computed an md5 (or
sha or whatever) and stored it in the db, then you could check to see if
an image exists by searching for the md5, which would be way faster, an
send a lot less data over the wire.

-Andy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Glenn Maynard 2011-03-08 19:29:58 Re: Why count(*) doest use index?
Previous Message Andre Lopes 2011-03-08 18:28:38 Using bytea field...