Обсуждение: large objects

Поиск
Список
Период
Сортировка

large objects

От
Pascal Cloup
Дата:
Hi,

Up to now, to store large objects i used the bytea data type. I experienced this without problem with objects of size of some tens of KBytes, without specifying any options.
Now, i plan to store much larger objects (tens of MBytes). After reading the documentation, it seems that i have two options:

- use the option WITH OIDS during CREATE TABLE or ALTER TABLE
or
- use the large objects capabilities supplied by postgreSQL.

Is it a good idea to store such large objects in DB? and if so, what is the best choice?
I work with postgresSQL 9.4.1, .net and C# under windows.

regards
Pascal

Re: large objects

От
hubert depesz lubaczewski
Дата:
On Tue, Jun 23, 2015 at 03:33:52PM +0200, Pascal Cloup wrote:
> - use the option WITH OIDS during CREATE TABLE or ALTER TABLE

WITH OIDS is in no way related to storing large blobs in tables, and
generally shouldn't be used.

> Is it a good idea to store such large objects in DB? and if so, what is the
> best choice?

In majority of cases, I would say that, storing binary blobs in database
is bad idea. Waste of resources. It's better store them on filesystem,
and in DB just store path to the file.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/


Fwd: large objects

От
Pascal Cloup
Дата:

Hi,
thanks for your reply.
At beginning that's what i thought, but leaving such data outside database creates other problems: accessibility, authorization, backup,...

If postgresql supplies some methods for large objects, i suppose that it has an adequate storage strategy, no?
I have mixed things when i spoke on OIDS (?), in fact i thought on TOAST.

regards
Pascal

2015-06-23 18:49 GMT+02:00 hubert depesz lubaczewski <depesz@depesz.com>:
On Tue, Jun 23, 2015 at 03:33:52PM +0200, Pascal Cloup wrote:
> - use the option WITH OIDS during CREATE TABLE or ALTER TABLE

WITH OIDS is in no way related to storing large blobs in tables, and
generally shouldn't be used.

> Is it a good idea to store such large objects in DB? and if so, what is the
> best choice?

In majority of cases, I would say that, storing binary blobs in database
is bad idea. Waste of resources. It's better store them on filesystem,
and in DB just store path to the file.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/