pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Storing large files in multiple schemas: BLOB or BYTEA
3+ messages / 3 participants
[nested] [flat]

* Storing large files in multiple schemas: BLOB or BYTEA
@ 2012-10-10 10:12 tigran2-postgres@riatest.com
  2012-10-11 12:59 ` Re: Storing large files in multiple schemas: BLOB or BYTEA John DeSoi <jdesoi@gmail.com>
  2012-10-11 13:05 ` Re: Storing large files in multiple schemas: BLOB or BYTEA John DeSoi <desoi@pgedit.com>
  0 siblings, 2 replies; 3+ messages in thread

From: tigran2-postgres@riatest.com @ 2012-10-10 10:12 UTC (permalink / raw)
  To: pgsql-php

Hi,

 

I need to store large files (from several MB to 1GB) in Postgres database.
The database has multiple schemas. It looks like Postgres has 2 options to
store large objects: LOB and BYTEA. However we seem to hit problems with
each of these options.

 

1. LOB. This works almost ideal, can store up to 2GB and allows streaming so
that we do not hit memory limits in our PHP backend when reading the LOB.
However all blobs are stored in pg_catalog and are not part of schema. This
leads to a big problem when you try to use pg_dump with options -n and -b to
dump just one schema with its blobs. It dumps the schema data correctly
however then it include ALL blobs in the database not just the blobs that
belong to the particular schema.

Is there a way to dump the single schema with its blobs using pg_dump or
some other utility?

 

2. BYTEA. These are correctly stored per schema so pg_dump -n works
correctly however I cannot seem to find a way to stream the data. This means
that there is no way to access the data from PHP if it is larger than memory
limit.

 

Is there any other way to store large data in Postgres that allows streaming
and correctly works with multiple schemas per database?

 

Thanks.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Storing large files in multiple schemas: BLOB or BYTEA
  2012-10-10 10:12 Storing large files in multiple schemas: BLOB or BYTEA tigran2-postgres@riatest.com
@ 2012-10-11 12:59 ` John DeSoi <jdesoi@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: John DeSoi @ 2012-10-11 12:59 UTC (permalink / raw)
  To: tigran2-postgres@riatest.com; +Cc: pgsql-php


On Oct 10, 2012, at 6:12 AM, tigran2-postgres@riatest.com wrote:

> 2. BYTEA. These are correctly stored per schema so pg_dump –n works correctly however I cannot seem to find a way to stream the data. This means that there is no way to access the data from PHP if it is larger than memory limit.

You can get the octet length and then use the substring function to grab large columns in chunks. See

http://www.postgresql.org/docs/current/interactive/functions-binarystring.html


John DeSoi, Ph.D.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Storing large files in multiple schemas: BLOB or BYTEA
  2012-10-10 10:12 Storing large files in multiple schemas: BLOB or BYTEA tigran2-postgres@riatest.com
@ 2012-10-11 13:05 ` John DeSoi <desoi@pgedit.com>
  1 sibling, 0 replies; 3+ messages in thread

From: John DeSoi @ 2012-10-11 13:05 UTC (permalink / raw)
  To: ; +Cc: pgsql-php


On Oct 10, 2012, at 6:12 AM, tigran2-postgres@riatest.com wrote:

> 2. BYTEA. These are correctly stored per schema so pg_dump –n works correctly however I cannot seem to find a way to stream the data. This means that there is no way to access the data from PHP if it is larger than memory limit.

You can get the octet length and then use the substring function to grab large columns in chunks. See

http://www.postgresql.org/docs/current/interactive/functions-binarystring.html


John DeSoi, Ph.D.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-10-11 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10 10:12 Storing large files in multiple schemas: BLOB or BYTEA tigran2-postgres@riatest.com
2012-10-11 12:59 ` John DeSoi <jdesoi@gmail.com>
2012-10-11 13:05 ` John DeSoi <desoi@pgedit.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox