pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Bram Van Steenlandt <bram@diomedia.be>
To: pgsql-performance@postgresql.org
Subject: Re: large object write performance
Date: Thu, 08 Oct 2015 14:29:28 +0200
Message-ID: <561661A8.90301@diomedia.be> (raw )
In-Reply-To: <68E43830-5272-4AE7-AAF5-3887E2EB3C01@skogoglandskap.no >
References: <561634BD.2000309@diomedia.be >
<3D2F06B8-297D-48CF-AA8C-47FD70925863@skogoglandskap.no >
<56164825.6050209@diomedia.be >
<F25A42D9-8A3D-4DC4-A25D-E3FD1A01C43F@skogoglandskap.no >
<5616588B.5000308@diomedia.be >
<68E43830-5272-4AE7-AAF5-3887E2EB3C01@skogoglandskap.no >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
Op 08-10-15 om 14:10 schreef Graeme B. Bell:
>> On 08 Oct 2015, at 13:50, Bram Van Steenlandt <bram@diomedia.be> wrote:
>>>> 1. The part is "fobj = lobject(db.db,0,"r",0,fpath)", I don't think there is anything there
> Re: lobject
>
> http://initd.org/psycopg/docs/usage.html#large-objects
>
> "Psycopg large object support *efficient* import/export with file system files using the lo_import() and lo_export() libpq functions.”
>
> See *
I was under the impression they meant that the lobject was using
lo_import and lo_export.
I can't seem to find how to use lo_import en export, I searched google
and came to the conclusion the lobject was the way to go.
>>> x.lo_import()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'psycopg2._psycopg.connection' object has no attribute
'lo_import'
>>> from psycopg2.extensions import lo_importTraceback (most recent
call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name lo_import
Also:
http://initd.org/psycopg/docs/connection.html
|lobject|([/oid/[, /mode/[, /new_oid/[, /new_file/[, /lobject_factory/]]]]])
Return a new database large object as a |lobject|
<http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.lobject ;
instance.
See Access to PostgreSQL large objects
<http://initd.org/psycopg/docs/usage.html#large-objects ; for an
overview.
Parameters:
* *oid* – The OID of the object to read or write. 0 to create a
new large object and and have its OID assigned automatically.
* *mode* – Access mode to the object, see below.
* *new_oid* – Create a new object using the specified OID. The
function raises |OperationalError|
<http://initd.org/psycopg/docs/module.html#psycopg2.OperationalError ;
if the OID is already in use. Default is 0, meaning assign a new
one automatically.
* *new_file* – The name of a file to be imported in the the
database (using the |lo_import()|
<http://www.postgresql.org/docs/current/static/lo-interfaces.html#LO-IMPORT ;
function)
* *lobject_factory* – Subclass of |lobject|
<http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.lobject ;
to be instantiated.
>
> lobject seems to default to string handling in Python
> That’s going to be slow.
> Try using lo_import / export?
>
> Graeme Bell
>
view thread (12+ messages) latest in thread
Message-ID: <561661A8.90301@diomedia.be>
Permalink: ../561661A8.90301@diomedia.be/
Also on: postgresql.org/message-id/561661A8.90301@diomedia.be
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: bram@diomedia.be
Subject: Re: large object write performance
In-Reply-To: <561661A8.90301@diomedia.be>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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