Re: Storing images in PostgreSQL databases (again)

Поиск
Список
Период
Сортировка
От Ron Johnson
Тема Re: Storing images in PostgreSQL databases (again)
Дата
Msg-id 4526A979.105@cox.net
обсуждение исходный текст
Ответ на Re: Storing images in PostgreSQL databases (again)  (Jean-Christophe Roux <jcxxr@yahoo.com>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/05/06 18:54, Jean-Christophe Roux wrote:
> Why would I set a bytea column (containing picures) as a primary
> key? Because I want to be sure that the same image is inserted
> only once (that requirement comes from a real project) and using
> a primary key for that purpose makes sense to me.

A hash function makes better sense.  SHA-1 creates a 20 byte string
that is the digest of the file.  Almost perfect as a primary key.

SHA-256 (so far!) guarantees uniqueness in 32 bytes.

>                                                    Am I going to
> retrieve an image row by its image data? I would certainly like!
> For instance, I would like to get the pictures whose main color
> is green (requirement from a real project), and a select * from
> images where main_color(image) = 'green' would be nice.

That would speedily be handled by preprocessing metadata records as
the image is inserted.

- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFJql5S9HxQb37XmcRAgYjAKCeTur3N/AUwQLI79GYbde8nCMYwACfejg+
Xe3qGl7GHlhC4jssvGkAJ6w=
=dW03
-----END PGP SIGNATURE-----

В списке pgsql-general по дате отправления:

Предыдущее
От: "Worky Workerson"
Дата:
Сообщение: Re: DELETE eats up all memory and crashes box
Следующее
От: Tom Lane
Дата:
Сообщение: Re: DELETE eats up all memory and crashes box