pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BYTEA Fields and Memory Consumption
6+ messages / 3 participants
[nested] [flat]

* BYTEA Fields and Memory Consumption
@ 2011-04-13 12:09  Raiford@labware.com
  0 siblings, 1 reply; 6+ messages in thread

From: Raiford@labware.com @ 2011-04-13 12:09 UTC (permalink / raw)
  To: pgsql-odbc

I have an issue where even though I break a large BYTEA object up into 
multiple pieces, the ODBC driver just rejoins the pieces in memory and 
tries to send it all out at once.  I took a look at the code and sure 
enough the driver just keeps reallocating memory for each chunk of data 
that I add.  Can I assume Postgres has no mechanism to send this data 
across the wire in pieces?  Are there any common practices for dealing 
with this?  As it is, in one environment I can only transfer files around 
50MB before I start receiving out of memory errors.  The same program 
running against Oracle and SQL Server works great.

Jon

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

* Re: BYTEA Fields and Memory Consumption
@ 2011-04-14 03:41  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Raiford@labware.com
  0 siblings, 1 reply; 6+ messages in thread

From: Hiroshi Inoue @ 2011-04-14 03:41 UTC (permalink / raw)
  To: Raiford@labware.com; +Cc: pgsql-odbc

Hi,

(2011/04/13 21:09), Raiford@labware.com wrote:
> I have an issue where even though I break a large BYTEA object up into
> multiple pieces, the ODBC driver just rejoins the pieces in memory and
> tries to send it all out at once. I took a look at the code and sure
> enough the driver just keeps reallocating memory for each chunk of data
> that I add.

Yes you are right.

 > Can I assume Postgres has no mechanism to send this data
> across the wire in pieces? Are there any common practices for dealing
> with this?

Please try lo type instead of bytea type.

regards,
Hiroshi Inoue

 > As it is, in one environment I can only transfer files around
> 50MB before I start receiving out of memory errors. The same program
> running against Oracle and SQL Server works great.
>
> Jon




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

* Re: BYTEA Fields and Memory Consumption
@ 2011-04-14 12:17  Raiford@labware.com
  parent: Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 6+ messages in thread

From: Raiford@labware.com @ 2011-04-14 12:17 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: pgsql-odbc; pgsql-odbc-owner@postgresql.org

Hi Hiroshi-san,

Thank you for your response.  Could you clarify one thing for me?  Are you 
suggesting that when using an lo datatype with the lo module installed, 
the ODBC driver automatically sends the data in pieces?  Or does it only 
open the possibility for me to use the lo_import() function?  If 
everything is handled internally in the ODBC driver, it would certainly 
help a lot :)

Jon



From:   Hiroshi Inoue <inoue@tpf.co.jp>
To:     Raiford@labware.com
Cc:     pgsql-odbc@postgresql.org
Date:   04/13/2011 11:42 PM
Subject:        Re: [ODBC] BYTEA Fields and Memory Consumption
Sent by:        pgsql-odbc-owner@postgresql.org



Hi,

(2011/04/13 21:09), Raiford@labware.com wrote:
> I have an issue where even though I break a large BYTEA object up into
> multiple pieces, the ODBC driver just rejoins the pieces in memory and
> tries to send it all out at once. I took a look at the code and sure
> enough the driver just keeps reallocating memory for each chunk of data
> that I add.

Yes you are right.

 > Can I assume Postgres has no mechanism to send this data
> across the wire in pieces? Are there any common practices for dealing
> with this?

Please try lo type instead of bytea type.

regards,
Hiroshi Inoue

 > As it is, in one environment I can only transfer files around
> 50MB before I start receiving out of memory errors. The same program
> running against Oracle and SQL Server works great.
>
> Jon


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

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

* Re: BYTEA Fields and Memory Consumption
@ 2011-04-14 23:42  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Raiford@labware.com
  0 siblings, 1 reply; 6+ messages in thread

From: Hiroshi Inoue @ 2011-04-14 23:42 UTC (permalink / raw)
  To: Raiford@labware.com; +Cc: pgsql-odbc

(2011/04/14 21:17), Raiford@labware.com wrote:
> Hi Hiroshi-san,
>
> Thank you for your response. Could you clarify one thing for me? Are you
> suggesting that when using an lo datatype with the lo module installed,

You don't have to install the lo module. Please type

	create domain lo as oid;

and use the lo type.

> the ODBC driver automatically sends the data in pieces?

Yes.

regards,
Hiroshi Inoue

 > Or does it only
> open the possibility for me to use the lo_import() function? If
> everything is handled internally in the ODBC driver, it would certainly
> help a lot :)
>
> Jon
>
> From: Hiroshi Inoue <inoue@tpf.co.jp>
> To: Raiford@labware.com
> Cc: pgsql-odbc@postgresql.org
> Date: 04/13/2011 11:42 PM
> Subject: Re: [ODBC] BYTEA Fields and Memory Consumption
> Sent by: pgsql-odbc-owner@postgresql.org
> ------------------------------------------------------------------------
>
> Hi,
>
> (2011/04/13 21:09), Raiford@labware.com wrote:
>  > I have an issue where even though I break a large BYTEA object up into
>  > multiple pieces, the ODBC driver just rejoins the pieces in memory and
>  > tries to send it all out at once. I took a look at the code and sure
>  > enough the driver just keeps reallocating memory for each chunk of data
>  > that I add.
>
> Yes you are right.
>
>  > Can I assume Postgres has no mechanism to send this data
>  > across the wire in pieces? Are there any common practices for dealing
>  > with this?
>
> Please try lo type instead of bytea type.
>
> regards,
> Hiroshi Inoue



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

* Re: BYTEA Fields and Memory Consumption
@ 2011-04-14 23:48  Ramesh Reddy <rareddy@redhat.com>
  parent: Hiroshi Inoue <inoue@tpf.co.jp>
  0 siblings, 1 reply; 6+ messages in thread

From: Ramesh Reddy @ 2011-04-14 23:48 UTC (permalink / raw)
  To: Hiroshi Inoue <inoue@tpf.co.jp>; +Cc: Raiford@labware.com; pgsql-odbc

In my experience even when using 'lo' the driver only got the first
chunk of data which is equal to the length of the buffer that client
provided and never went back to ask for next chunk.

Also, I am not sure how one can read multiple blocks from client code?

Ramesh..

On Fri, 2011-04-15 at 08:42 +0900, Hiroshi Inoue wrote:
> (2011/04/14 21:17), Raiford@labware.com wrote:
> > Hi Hiroshi-san,
> >
> > Thank you for your response. Could you clarify one thing for me? Are you
> > suggesting that when using an lo datatype with the lo module installed,
> 
> You don't have to install the lo module. Please type
> 
> 	create domain lo as oid;
> 
> and use the lo type.
> 
> > the ODBC driver automatically sends the data in pieces?
> 
> Yes.
> 
> regards,
> Hiroshi Inoue
> 
>  > Or does it only
> > open the possibility for me to use the lo_import() function? If
> > everything is handled internally in the ODBC driver, it would certainly
> > help a lot :)
> >
> > Jon
> >
> > From: Hiroshi Inoue <inoue@tpf.co.jp>
> > To: Raiford@labware.com
> > Cc: pgsql-odbc@postgresql.org
> > Date: 04/13/2011 11:42 PM
> > Subject: Re: [ODBC] BYTEA Fields and Memory Consumption
> > Sent by: pgsql-odbc-owner@postgresql.org
> > ------------------------------------------------------------------------
> >
> > Hi,
> >
> > (2011/04/13 21:09), Raiford@labware.com wrote:
> >  > I have an issue where even though I break a large BYTEA object up into
> >  > multiple pieces, the ODBC driver just rejoins the pieces in memory and
> >  > tries to send it all out at once. I took a look at the code and sure
> >  > enough the driver just keeps reallocating memory for each chunk of data
> >  > that I add.
> >
> > Yes you are right.
> >
> >  > Can I assume Postgres has no mechanism to send this data
> >  > across the wire in pieces? Are there any common practices for dealing
> >  > with this?
> >
> > Please try lo type instead of bytea type.
> >
> > regards,
> > Hiroshi Inoue
> 





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

* Re: BYTEA Fields and Memory Consumption
@ 2011-04-15 03:34  Hiroshi Inoue <inoue@tpf.co.jp>
  parent: Ramesh Reddy <rareddy@redhat.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Hiroshi Inoue @ 2011-04-15 03:34 UTC (permalink / raw)
  To: rareddy@redhat.com; +Cc: Raiford@labware.com; pgsql-odbc

Hi Ramesh,

(2011/04/15 8:48), Ramesh Reddy wrote:
> In my experience even when using 'lo' the driver only got the first
> chunk of data which is equal to the length of the buffer that client
> provided and never went back to ask for next chunk.

Clients have to call some special API/methods provided by the
interface they are using, e.g. ODBC native apps calls SQLPutData(),
  ADO apps calls AppendChunk().

regards,
Hiroshi Inoue

> Also, I am not sure how one can read multiple blocks from client code?
>
> Ramesh..
>
> On Fri, 2011-04-15 at 08:42 +0900, Hiroshi Inoue wrote:
>> (2011/04/14 21:17), Raiford@labware.com wrote:
>>> Hi Hiroshi-san,
>>>
>>> Thank you for your response. Could you clarify one thing for me? Are you
>>> suggesting that when using an lo datatype with the lo module installed,
>>
>> You don't have to install the lo module. Please type
>>
>> 	create domain lo as oid;
>>
>> and use the lo type.
>>
>>> the ODBC driver automatically sends the data in pieces?
>>
>> Yes.
>>
>> regards,
>> Hiroshi Inoue
>>
>>   >  Or does it only
>>> open the possibility for me to use the lo_import() function? If
>>> everything is handled internally in the ODBC driver, it would certainly
>>> help a lot :)
>>>
>>> Jon
>>>
>>> From: Hiroshi Inoue<inoue@tpf.co.jp>
>>> To: Raiford@labware.com
>>> Cc: pgsql-odbc@postgresql.org
>>> Date: 04/13/2011 11:42 PM
>>> Subject: Re: [ODBC] BYTEA Fields and Memory Consumption
>>> Sent by: pgsql-odbc-owner@postgresql.org
>>> ------------------------------------------------------------------------
>>>
>>> Hi,
>>>
>>> (2011/04/13 21:09), Raiford@labware.com wrote:
>>>   >  I have an issue where even though I break a large BYTEA object up into
>>>   >  multiple pieces, the ODBC driver just rejoins the pieces in memory and
>>>   >  tries to send it all out at once. I took a look at the code and sure
>>>   >  enough the driver just keeps reallocating memory for each chunk of data
>>>   >  that I add.
>>>
>>> Yes you are right.
>>>
>>>   >  Can I assume Postgres has no mechanism to send this data
>>>   >  across the wire in pieces? Are there any common practices for dealing
>>>   >  with this?
>>>
>>> Please try lo type instead of bytea type.
>>>
>>> regards,
>>> Hiroshi Inoue



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


end of thread, other threads:[~2011-04-15 03:34 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-13 12:09 BYTEA Fields and Memory Consumption Raiford@labware.com
2011-04-14 03:41 ` Hiroshi Inoue <inoue@tpf.co.jp>
2011-04-14 12:17   ` Raiford@labware.com
2011-04-14 23:42     ` Hiroshi Inoue <inoue@tpf.co.jp>
2011-04-14 23:48       ` Ramesh Reddy <rareddy@redhat.com>
2011-04-15 03:34         ` Hiroshi Inoue <inoue@tpf.co.jp>

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