By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,542 Members | 1,740 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,542 IT Pros & Developers. It's quick & easy.

Picture with Postgres and Delphi

P: n/a
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #1
Share this Question
Share on Google+
48 Replies


P: n/a
Hi,

Edwin Quijada wrote:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??

Yes, generally you have two choices, but you can as well store data in
files and get it by stored procedures... Any way I did it with FTP (Indy
component). It allowed me to cache files locally.

--
Regards,
Micha³ Zaborowski (TeXXaS)


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #2

P: n/a
Hi Edwin,

it depends on the components u use in Delphi. Normally Pictures and
ohter binary data is stored in the FieldType oid. I noticed that bytea
isn't mapped as TBlobField in Delphi in most components. I also don't
know if you are able to use the PG-Functions lo_import(), lo_export()
and so on with bytea. I use oid with Delphi and that works fine for me.
In Delphi you can use Procedures like TBlobField(MyField).LoadFromFile.
Post a Picture to the Server will look like this :

DataSet.Insert;
DataSet.BlobField.LoadFromFile('MyPictureFile');
DataSet.Post;

Now your pitcure is on the Server. You are also able to use standard
DBPicture-components...

Daniel

Am Di, 2003-09-09 um 18.54 schrieb Edwin Quijada:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #3

P: n/a

----- Original Message -----
From: "listy.mailowe" <li***********@wp.pl>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 8:10 PM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

Hi,

Edwin Quijada wrote:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox. What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this. Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??

Yes, generally you have two choices, but you can as well store data in
files and get it by stored procedures... Any way I did it with FTP (Indy
component). It allowed me to cache files locally.

There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq has
great support for large objects, and you can store large object without
actually storing them on server filesystem, so You do not need any file
permissions on "upload directory" or something like that.
If You are using Delphi, there is great project called "Zeos objects", and
if I remember correctly it has support for large objects.

Regards !
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #4

P: n/a

----- Original Message -----
From: "Edwin Quijada" <li************@hotmail.com>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 6:54 PM
Subject: [GENERAL] Picture with Postgres and Delphi

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??


You may choose between Bytea or large objects.
I had some problems with bytea on earlier version of pg (7.2 I think), but
last time I checked (7.3), all worked fine.
However, I use large objects.
The only disadvantage of large objects I see is that You can't dump them
into textual dump. You must use binary dumps.

Regards !
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #5

P: n/a
On Tue, 9 Sep 2003, Darko Prenosil wrote:

----- Original Message -----
From: "Edwin Quijada" <li************@hotmail.com>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 6:54 PM
Subject: [GENERAL] Picture with Postgres and Delphi

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way

to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??


You may choose between Bytea or large objects.
I had some problems with bytea on earlier version of pg (7.2 I think), but
last time I checked (7.3), all worked fine.
However, I use large objects.
The only disadvantage of large objects I see is that You can't dump them
into textual dump. You must use binary dumps.


for portability, I've always base64 encoded and stored them as straight
text. That works well too.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #6

P: n/a
I'm a big fan of bytea. In every case where I've done the filesystem
method I wished I hadn't.

Jon

On Tue, 9 Sep 2003, Edwin Quijada wrote:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #7

P: n/a
--- Jonathan Bartlett <jo*****@eskimo.com> wrote:
I'm a big fan of bytea. In every case where I've
done the filesystem
method I wished I hadn't.


For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #8

P: n/a
Hi Edwin,

it depends on the components u use in Delphi. Normally Pictures and
ohter binary data is stored in the FieldType oid. I noticed that bytea
isn't mapped as TBlobField in Delphi in most components. I also don't
know if you are able to use the PG-Functions lo_import(), lo_export()
and so on with bytea. I use oid with Delphi and that works fine for me.
In Delphi you can use Procedures like TBlobField(MyField).LoadFromFile.
Post a Picture to the Server will look like this :

DataSet.Insert;
DataSet.BlobField.LoadFromFile('MyPictureFile');
DataSet.Post;

Now your pitcure is on the Server. You are also able to use standard
DBPicture-components...

Daniel

Am Di, 2003-09-09 um 18.54 schrieb Edwin Quijada:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #9

P: n/a

----- Original Message -----
From: "listy.mailowe" <li***********@wp.pl>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 8:10 PM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

Hi,

Edwin Quijada wrote:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox. What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this. Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??

Yes, generally you have two choices, but you can as well store data in
files and get it by stored procedures... Any way I did it with FTP (Indy
component). It allowed me to cache files locally.

There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq has
great support for large objects, and you can store large object without
actually storing them on server filesystem, so You do not need any file
permissions on "upload directory" or something like that.
If You are using Delphi, there is great project called "Zeos objects", and
if I remember correctly it has support for large objects.

Regards !
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #10

P: n/a

----- Original Message -----
From: "Edwin Quijada" <li************@hotmail.com>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 6:54 PM
Subject: [GENERAL] Picture with Postgres and Delphi

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??


You may choose between Bytea or large objects.
I had some problems with bytea on earlier version of pg (7.2 I think), but
last time I checked (7.3), all worked fine.
However, I use large objects.
The only disadvantage of large objects I see is that You can't dump them
into textual dump. You must use binary dumps.

Regards !
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #11

P: n/a
> For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #12

P: n/a
On Tue, 9 Sep 2003, Darko Prenosil wrote:

----- Original Message -----
From: "Edwin Quijada" <li************@hotmail.com>
To: <pg***********@postgresql.org>
Sent: Tuesday, September 09, 2003 6:54 PM
Subject: [GENERAL] Picture with Postgres and Delphi

Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way

to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??


You may choose between Bytea or large objects.
I had some problems with bytea on earlier version of pg (7.2 I think), but
last time I checked (7.3), all worked fine.
However, I use large objects.
The only disadvantage of large objects I see is that You can't dump them
into textual dump. You must use binary dumps.


for portability, I've always base64 encoded and stored them as straight
text. That works well too.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #13

P: n/a
I'm a big fan of bytea. In every case where I've done the filesystem
method I wished I hadn't.

Jon

On Tue, 9 Sep 2003, Edwin Quijada wrote:
Hi !! Everybody
I am developing app using Delphi and I have a question:
I have to save pictures into my database. Each picture has 20 o 30k aprox.
What is the way more optimus?
That 's table will have 500000 records around. Somebody said the best way to
do that was encoder the picture to field bytea but I dont know about this.
Another way is save the path to the picture file but I dont like so much
because I need to write to disk by OS and have permission to write a
directory to OS.
What do u think??
Edwin Quijada

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #14

P: n/a
--- Jonathan Bartlett <jo*****@eskimo.com> wrote:
I'm a big fan of bytea. In every case where I've
done the filesystem
method I wished I hadn't.


For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #15

P: n/a
> For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #16

P: n/a
What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #17

P: n/a
Is the size limit 8K for 'text' field types as well?

----- Original Message -----
From: "Guy Fraser" <gu*@incentre.net>
To: <pg***********@postgresql.org>
Sent: Wednesday, September 10, 2003 9:40 AM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #18

P: n/a
> > What is the size limit of bytea, I thought it was 8K?

No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?
Nope. pg_dump automagically escapes everything.
What are you using to insert the binary data?
Perl example:

my $COMPLETED_TEMPLATE_VARS_INSERT = <<EOF; insert into
completed_template_vars (completed_template, name, value, binvalue) VALUES
(?, ?, ?, ?)
EOF

$sth = $dbh->prepare($COMPLETED_TEMPLATE_VARS_INSERT);
$value = undef;
$binvalue = $field->{BINANS};
$value = $field->{ANS} unless $binvalue;
$sth->bind_param(1, $self->getOID);
$sth->bind_param(2, $name);
$sth->bind_param(3, $value);
$sth->bind_param(4, $binvalue, DBI::SQL_BINARY);
$sth->execute || die("DBERROR:${DBI::errstr}:");

Note that I explicityl set DBI::SQL_BINARY.

Now, for php, you do the following:

$logodata = pg_escape_bytea($tmpdata);
$tmpsql = "update advertisements set $column_name = '$logodata'::bytea where object_id = $advertisement_oid";
$tmp = $db->query($tmpsql);

I never got it to work with parameterized queries, but this works fine for
me. To select it back out, you need to do:

$q = $db->query("select teaser_logo_gif_image from advertisements where
object_id = ?::int8", array($_GET['advertisement']));
$row = $q->fetchrow();
$data = pg_unescape_bytea($row[0]);

NOTE that many versions of PHP include pg_escape_bytea but NOT
pg_unescape_bytea. Look in the docs to see which function appeared in
which version.

Jon

Jonathan Bartlett wrote:
>For the education of me and maybe others too, why was
>that? i.e. what problems did you run into, that bytea avoids?
>
>
>

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon


>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>
>
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #19

P: n/a
What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #20

P: n/a
text types are limited to ~1 Gig depending on things like encoding and
what not, you might get as much as 2 gig per record.

On Wed, 10 Sep 2003, Derrick Betts wrote:
Is the size limit 8K for 'text' field types as well?

----- Original Message -----
From: "Guy Fraser" <gu*@incentre.net>
To: <pg***********@postgresql.org>
Sent: Wednesday, September 10, 2003 9:40 AM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
>For the education of me and maybe others too, why was
>that? i.e. what problems did you run into, that bytea avoids?
>
>
>

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon


>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>
>
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #21

P: n/a
Is the size limit 8K for 'text' field types as well?

----- Original Message -----
From: "Guy Fraser" <gu*@incentre.net>
To: <pg***********@postgresql.org>
Sent: Wednesday, September 10, 2003 9:40 AM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #22

P: n/a
> > What is the size limit of bytea, I thought it was 8K?

No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?
Nope. pg_dump automagically escapes everything.
What are you using to insert the binary data?
Perl example:

my $COMPLETED_TEMPLATE_VARS_INSERT = <<EOF; insert into
completed_template_vars (completed_template, name, value, binvalue) VALUES
(?, ?, ?, ?)
EOF

$sth = $dbh->prepare($COMPLETED_TEMPLATE_VARS_INSERT);
$value = undef;
$binvalue = $field->{BINANS};
$value = $field->{ANS} unless $binvalue;
$sth->bind_param(1, $self->getOID);
$sth->bind_param(2, $name);
$sth->bind_param(3, $value);
$sth->bind_param(4, $binvalue, DBI::SQL_BINARY);
$sth->execute || die("DBERROR:${DBI::errstr}:");

Note that I explicityl set DBI::SQL_BINARY.

Now, for php, you do the following:

$logodata = pg_escape_bytea($tmpdata);
$tmpsql = "update advertisements set $column_name = '$logodata'::bytea where object_id = $advertisement_oid";
$tmp = $db->query($tmpsql);

I never got it to work with parameterized queries, but this works fine for
me. To select it back out, you need to do:

$q = $db->query("select teaser_logo_gif_image from advertisements where
object_id = ?::int8", array($_GET['advertisement']));
$row = $q->fetchrow();
$data = pg_unescape_bytea($row[0]);

NOTE that many versions of PHP include pg_escape_bytea but NOT
pg_unescape_bytea. Look in the docs to see which function appeared in
which version.

Jon

Jonathan Bartlett wrote:
>For the education of me and maybe others too, why was
>that? i.e. what problems did you run into, that bytea avoids?
>
>
>

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon


>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>
>
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #23

P: n/a
"Derrick Betts" <De*****@grifflink.com> writes:
Is the size limit 8K for 'text' field types as well?


There is no size limit (OK, a very very large one) on either "text" or
"bytea" in modern versions of Postgres.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #24

P: n/a
text types are limited to ~1 Gig depending on things like encoding and
what not, you might get as much as 2 gig per record.

On Wed, 10 Sep 2003, Derrick Betts wrote:
Is the size limit 8K for 'text' field types as well?

----- Original Message -----
From: "Guy Fraser" <gu*@incentre.net>
To: <pg***********@postgresql.org>
Sent: Wednesday, September 10, 2003 9:40 AM
Subject: Re: [GENERAL] Picture with Postgres and Delphi

What is the size limit of bytea, I thought it was 8K?

How do you dump your database when you have bytea, do you need to do a
binary dump?

What are you using to insert the binary data?

Thank you in advance.

Guy

Jonathan Bartlett wrote:
>For the education of me and maybe others too, why was
>that? i.e. what problems did you run into, that bytea avoids?
>
>
>

Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon


>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>
>
>
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #25

P: n/a
How do you deal with backing up the images? Right now i can remote
backup my filesystem using rsync to an offsite location many times a
day, only taking a very small amount of I/O, bandwidth and time.
Dealing with the backup scared me away from using postgres in the first
place. The idea of doing a 200gb dump multiple times a day on an
image database scares me. So does doing a vacuum on it. The I/O,
time and bandwidth required to do this is daunting.

Are there any suggestions on how to do incremental backups of the
images and any other suggestions on performance? In the future I'd
like to move some filesystem images to postgres to have a centralized
storage. It would make some things easier, but i'm not sure it's worth
the additional problems. Hopefully i'm imagining the problems.

--brian

On Tuesday, September 9, 2003, at 08:56 PM, Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so
you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with
a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #26

P: n/a
On Wednesday 10 September 2003 17:17, Derrick Betts wrote:
Is the size limit 8K for 'text' field types as well?
What is the size limit of bytea, I thought it was 8K?


Not for some time now - the TOAST system (Tom Lane's work IIRC) means you can
store large text fields in a table. By large I mean MB large, not 64k or
something. I think there's a section on TOAST in the manuals.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #27

P: n/a
"Derrick Betts" <De*****@grifflink.com> writes:
Is the size limit 8K for 'text' field types as well?


There is no size limit (OK, a very very large one) on either "text" or
"bytea" in modern versions of Postgres.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #28

P: n/a
Darko Prenosil wrote:

There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq has
great support for large objects, and you can store large object without
actually storing them on server filesystem, so You do not need any file
permissions on "upload directory" or something like that.
The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...
If You are using Delphi, there is great project called "Zeos objects", and
if I remember correctly it has support for large objects.

Zeos are useing a lot of memory...

Regards,
Micha³ Zaborowski (TeXXaS)
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #29

P: n/a
How do you deal with backing up the images? Right now i can remote
backup my filesystem using rsync to an offsite location many times a
day, only taking a very small amount of I/O, bandwidth and time.
Dealing with the backup scared me away from using postgres in the first
place. The idea of doing a 200gb dump multiple times a day on an
image database scares me. So does doing a vacuum on it. The I/O,
time and bandwidth required to do this is daunting.

Are there any suggestions on how to do incremental backups of the
images and any other suggestions on performance? In the future I'd
like to move some filesystem images to postgres to have a centralized
storage. It would make some things easier, but i'm not sure it's worth
the additional problems. Hopefully i'm imagining the problems.

--brian

On Tuesday, September 9, 2003, at 08:56 PM, Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so
you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with
a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of
broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 11 '05 #30

P: n/a
On Wednesday 10 September 2003 17:17, Derrick Betts wrote:
Is the size limit 8K for 'text' field types as well?
What is the size limit of bytea, I thought it was 8K?


Not for some time now - the TOAST system (Tom Lane's work IIRC) means you can
store large text fields in a table. By large I mean MB large, not 64k or
something. I think there's a section on TOAST in the manuals.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 11 '05 #31

P: n/a
Thanks that is extremely helpfull.

Guy

Jonathan Bartlett wrote:
What is the size limit of bytea, I thought it was 8K?
No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?
Nope. pg_dump automagically escapes everything.
What are you using to insert the binary data?


Perl example:

my $COMPLETED_TEMPLATE_VARS_INSERT = <<EOF; insert into
completed_template_vars (completed_template, name, value, binvalue) VALUES
(?, ?, ?, ?)
EOF

$sth = $dbh->prepare($COMPLETED_TEMPLATE_VARS_INSERT);
$value = undef;
$binvalue = $field->{BINANS};
$value = $field->{ANS} unless $binvalue;
$sth->bind_param(1, $self->getOID);
$sth->bind_param(2, $name);
$sth->bind_param(3, $value);
$sth->bind_param(4, $binvalue, DBI::SQL_BINARY);
$sth->execute || die("DBERROR:${DBI::errstr}:");

Note that I explicityl set DBI::SQL_BINARY.

Now, for php, you do the following:

$logodata = pg_escape_bytea($tmpdata);
$tmpsql = "update advertisements set $column_name = '$logodata'::bytea where object_id = $advertisement_oid";
$tmp = $db->query($tmpsql);

I never got it to work with parameterized queries, but this works fine for
me. To select it back out, you need to do:

$q = $db->query("select teaser_logo_gif_image from advertisements where
object_id = ?::int8", array($_GET['advertisement']));
$row = $q->fetchrow();
$data = pg_unescape_bytea($row[0]);

NOTE that many versions of PHP include pg_escape_bytea but NOT
pg_unescape_bytea. Look in the docs to see which function appeared in
which version.

Jon

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #32

P: n/a
Darko Prenosil wrote:

There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq has
great support for large objects, and you can store large object without
actually storing them on server filesystem, so You do not need any file
permissions on "upload directory" or something like that.
The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...
If You are using Delphi, there is great project called "Zeos objects", and
if I remember correctly it has support for large objects.

Zeos are useing a lot of memory...

Regards,
Micha³ Zaborowski (TeXXaS)
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #33

P: n/a
Richard Huxton <de*@archonet.com> writes:
On Wednesday 10 September 2003 17:17, Derrick Betts wrote:
What is the size limit of bytea, I thought it was 8K?
Not for some time now - the TOAST system (Tom Lane's work IIRC)


Not my work, Jan Wieck's. But yes, the 8K limit is ancient history.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #34

P: n/a
> What is the size limit of bytea, I thought it was 8K?

No limit
How do you dump your database when you have bytea, do you need to do a
binary dump?
Just dump it normally.
What are you using to insert the binary data?
Depends. For php, I use pg_escape_bytea, and just use it as an in-query
string value. For perl, I use bind_param with SQL_BINARY.

Jon

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #35

P: n/a
Thanks that is extremely helpfull.

Guy

Jonathan Bartlett wrote:
What is the size limit of bytea, I thought it was 8K?
No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?
Nope. pg_dump automagically escapes everything.
What are you using to insert the binary data?


Perl example:

my $COMPLETED_TEMPLATE_VARS_INSERT = <<EOF; insert into
completed_template_vars (completed_template, name, value, binvalue) VALUES
(?, ?, ?, ?)
EOF

$sth = $dbh->prepare($COMPLETED_TEMPLATE_VARS_INSERT);
$value = undef;
$binvalue = $field->{BINANS};
$value = $field->{ANS} unless $binvalue;
$sth->bind_param(1, $self->getOID);
$sth->bind_param(2, $name);
$sth->bind_param(3, $value);
$sth->bind_param(4, $binvalue, DBI::SQL_BINARY);
$sth->execute || die("DBERROR:${DBI::errstr}:");

Note that I explicityl set DBI::SQL_BINARY.

Now, for php, you do the following:

$logodata = pg_escape_bytea($tmpdata);
$tmpsql = "update advertisements set $column_name = '$logodata'::bytea where object_id = $advertisement_oid";
$tmp = $db->query($tmpsql);

I never got it to work with parameterized queries, but this works fine for
me. To select it back out, you need to do:

$q = $db->query("select teaser_logo_gif_image from advertisements where
object_id = ?::int8", array($_GET['advertisement']));
$row = $q->fetchrow();
$data = pg_unescape_bytea($row[0]);

NOTE that many versions of PHP include pg_escape_bytea but NOT
pg_unescape_bytea. Look in the docs to see which function appeared in
which version.

Jon

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #36

P: n/a
Richard Huxton <de*@archonet.com> writes:
On Wednesday 10 September 2003 17:17, Derrick Betts wrote:
What is the size limit of bytea, I thought it was 8K?
Not for some time now - the TOAST system (Tom Lane's work IIRC)


Not my work, Jan Wieck's. But yes, the 8K limit is ancient history.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 11 '05 #37

P: n/a
On Wednesday 10 September 2003 21:36, Micha³ Zaborowski wrote:
Darko Prenosil wrote:
There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq
has great support for large objects, and you can store large object
without actually storing them on server filesystem, so You do not need
any file permissions on "upload directory" or something like that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...
If You are using Delphi, there is great project called "Zeos objects",
and if I remember correctly it has support for large objects.


Zeos are useing a lot of memory...

Regards,
Micha³ Zaborowski (TeXXaS)

I do not remember that this was the problem whan I used it. I was also diging
through that code, because I was writing something similar to dataset for QT.
What actually "Zeos are useing a lot of memory..." means ? A lot of alocated
space for result ?

Regards !

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #38

P: n/a
> What is the size limit of bytea, I thought it was 8K?

No limit
How do you dump your database when you have bytea, do you need to do a
binary dump?
Just dump it normally.
What are you using to insert the binary data?
Depends. For php, I use pg_escape_bytea, and just use it as an in-query
string value. For perl, I use bind_param with SQL_BINARY.

Jon

Thank you in advance.

Guy

Jonathan Bartlett wrote:
For the education of me and maybe others too, why was
that? i.e. what problems did you run into, that bytea avoids?


Compared to the filesystem, bytea provides data integrity.

Bytea gives you remote access, which you can cache if needed.

Bytea gives you the same permissions as anything else in Postgres, so you
don't have to worry about that separately.

Compared to BLOBs, bytea's are just simpler. You can select them with a
single statement, you don't have to worry about leaving unreferenced
BLOBs, and, after 4 billion inserts, byteas are still meaningful while
BLOBs might not be. (due to OID problems).

Jon

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html


--
Guy Fraser
Network Administrator
The Internet Centre
780-450-6787 , 1-888-450-6787

There is a fine line between genius and lunacy, fear not, walk the
line with pride. Not all things will end up as you wanted, but you
will certainly discover things the meek and timid will miss out on.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 11 '05 #39

P: n/a
>> If You are using Delphi, there is great project called "Zeos
objects", and if I remember correctly it has support for large
objects.

Zeos are useing a lot of memory...


Another issue I had with Zeos was that when I looked into possibly using
those components (this was probably over a year ago now), and tried
connecting to a database which is configured for md5 password encryption,
I got some kind of error message about that (md5 password authentication)
not being supported. Perhaps it works differently now, but be forewarned
to look at that if you need that type of authentication for your
database.

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #40

P: n/a
On Wednesday 10 September 2003 21:36, Micha³ Zaborowski wrote:
Darko Prenosil wrote:
There is no need for manually storing files on filesystem, because large
objects are doing that for You. I am storing whole binary files in
blobs(synonym for large objects from some other platforms), and I do not
remember that I had a single problem with that. Do not forget that libpq
has great support for large objects, and you can store large object
without actually storing them on server filesystem, so You do not need
any file permissions on "upload directory" or something like that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...
If You are using Delphi, there is great project called "Zeos objects",
and if I remember correctly it has support for large objects.


Zeos are useing a lot of memory...

Regards,
Micha³ Zaborowski (TeXXaS)

I do not remember that this was the problem whan I used it. I was also diging
through that code, because I was writing something similar to dataset for QT.
What actually "Zeos are useing a lot of memory..." means ? A lot of alocated
space for result ?

Regards !

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #41

P: n/a
>> If You are using Delphi, there is great project called "Zeos
objects", and if I remember correctly it has support for large
objects.

Zeos are useing a lot of memory...


Another issue I had with Zeos was that when I looked into possibly using
those components (this was probably over a year ago now), and tried
connecting to a database which is configured for md5 password encryption,
I got some kind of error message about that (md5 password authentication)
not being supported. Perhaps it works differently now, but be forewarned
to look at that if you need that type of authentication for your
database.

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #42

P: n/a
>> There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...

[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?

--
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.

Nov 12 '05 #43

P: n/a
Randolf Richardson, DevNet SysOp 29 wrote:
There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...


[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?


CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static content
delivery, you should use small web servers like boa. It outperforms apache2 by
upto 3 times for statis delivery..

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #44

P: n/a
Randolf Richardson, DevNet SysOp 29 wrote:
There is no need for manually storing files on filesystem, because
large objects are doing that for You. I am storing whole binary files
in blobs(synonym for large objects from some other platforms), and I do
not remember that I had a single problem with that. Do not forget that
libpq has great support for large objects, and you can store large
object without actually storing them on server filesystem, so You do
not need any file permissions on "upload directory" or something like
that.


The pictures are prepared for web. Storing in files is faster from
that side. That system is calling db every 30 mins...


[sNip]

Has anyone done any benchmarks on this to know what the performance
differences are for downloads (I'm not concerned about uploads since they're
far less frequent) from a web server such as Apache HTTPd accessing the file
system directly vs. a CGI script/program sending it dynamically through
Apache HTTPd?


CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static content
delivery, you should use small web servers like boa. It outperforms apache2 by
upto 3 times for statis delivery..

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #45

P: n/a
[sNip]
CGI will be slow. Of course.

If you write fastCGI, that would be hell lot fast. For ultrafast static
Well, MOD_PERL and DBI.pm are part of the equation. So is NetWare,
which is still the undisputed champion of file and print servers.
content delivery, you should use small web servers like boa. It
outperforms apache2 by upto 3 times for statis delivery..


Do you know if BOA has been ported to NetWare? If not, then it's
simply not an option for me as one of my requirements is cross-platform
support. Apache is extremely flexible, and so it has been difficult for me
to justify anything else, but I am certainly open to looking at other
options for handling some aspects of this project.

Apache 2 also has options to load entire directories of files into RAM
for faster access. Although I haven't tested this yet, the concept seems
very good and I will probably use it for all the long-term static content
in my future projects.

--
Randolf Richardson - rr@8x.ca
Inter-Corporate Computer & Network Services, Inc.
Vancouver, British Columbia, Canada
http://www.8x.ca/

This message originated from within a secure, reliable,
high-performance network ... a Novell NetWare network.

Nov 12 '05 #46

P: n/a
[apologies -- this amounts to a cross-post on subject "DB with bytea
types reload problem" -- I'm fairly desperate!]

Hi Jonathan

I saved a db with some bytea columns to text using

pg_dump -a -d <db> > out.sql

If I go

psql: \i out.sql

multiple errors result, such as:

psql:out.sql:505: invalid command \N
psql:out.sql:505: invalid command \

The sql dump file has lines starting something like this for the photo table:
1 500 375 h \\377\\330\\377\\340\\000\\020JFIF\\000\\001\\001\ \001\\000H\\000H\\000\\000\\377\\341\\023>Exif\\00 0\\000MM\\000*\\000\\000\\000\\010\\000\\012\\00.. ..

Is there any way I can retrieve the image data?

Rory

On 10/09/03, Jonathan Bartlett (jo*****@eskimo.com) wrote:
What is the size limit of bytea, I thought it was 8K?
No limit that I've found. Some are several meg.
How do you dump your database when you have bytea, do you need to do a
binary dump?


Nope. pg_dump automagically escapes everything.

--
Rory Campbell-Lange
<ro**@campbell-lange.net>
<www.campbell-lange.net>

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #47

P: n/a
It's always worked for me just by typing from the command line:

psql -U USERNAME DBNAME < backup.sql

Jon

On Tue, 16 Dec 2003, Rory Campbell-Lange wrote:
[apologies -- this amounts to a cross-post on subject "DB with bytea
types reload problem" -- I'm fairly desperate!]

Hi Jonathan

I saved a db with some bytea columns to text using

pg_dump -a -d <db> > out.sql

If I go

psql: \i out.sql

multiple errors result, such as:

psql:out.sql:505: invalid command \N
psql:out.sql:505: invalid command \

The sql dump file has lines starting something like this for the photo table:
1 500 375 h \\377\\330\\377\\340\\000\\020JFIF\\000\\001\\001\ \001\\000H\\000H\\000\\000\\377\\341\\023>Exif\\00 0\\000MM\\000*\\000\\000\\000\\010\\000\\012\\00.. ..

Is there any way I can retrieve the image data?

Rory

On 10/09/03, Jonathan Bartlett (jo*****@eskimo.com) wrote:
> What is the size limit of bytea, I thought it was 8K?


No limit that I've found. Some are several meg.
> How do you dump your database when you have bytea, do you need to do a
> binary dump?


Nope. pg_dump automagically escapes everything.

--
Rory Campbell-Lange
<ro**@campbell-lange.net>
<www.campbell-lange.net>

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #48

P: n/a
Rory Campbell-Lange <ro**@campbell-lange.net> writes:
I saved a db with some bytea columns to text using
pg_dump -a -d <db> > out.sql


You should not need a binary dump for bytea. However, in versions
before 7.3.5 there is a potential for problems if the data goes through
any kind of locale or encoding translation --- see
http://archives.postgresql.org/pgsql...1/msg00140.php

I'm not sure if that's what happened to you, or if there's any easy way
to reverse the conversion on your file if that is what happened, but
it's an avenue to pursue.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #49

This discussion thread is closed

Replies have been disabled for this discussion.