Thread: Using Large Object in PostgreSQL

Using Large Object in PostgreSQL

From
"Simon Shum"
Date:
I just used oid as a reference to store some binary large object.
After some time, I find that the data build up to a very large size 3.xx GB but I just have  2 or 3 records with a binary large object inside. So what may be the problem?
by the way, I just delete the records with oid field using delete from table where id = 'xxx'. Will this left a unreferenced copy of large object inside the database? If yes, what should I do?
Thx in advance.

Re: Using Large Object in PostgreSQL

From
Tom Lane
Date:
"Simon Shum" <s035668@mailserv.cuhk.edu.hk> writes:
> I just used oid as a reference to store some binary large object.
> After some time, I find that the data build up to a very large size 3.xx GB=
>  but I just have  2 or 3 records with a binary large object inside. So what=
>  may be the problem?
> by the way, I just delete the records with oid field using delete from tabl=
> e where id =3D 'xxx'. Will this left a unreferenced copy of large object in=
> side the database?

Yes.

> If yes, what should I do?

contrib/vacuumlo will help you identify the large objects that need to
be removed.  After you get done, pg_largeobject will need a VACUUM
FULL.

See also contrib/lo, which is a wrapper datatype that deletes large
objects when you delete the reference.  This is probably closer to the
behavior you were expecting.

            regards, tom lane