Bytea/Text blob deletion is very slow... - Mailing list pgsql-general

From Durumdara
Subject Bytea/Text blob deletion is very slow...
Date
Msg-id AANLkTik5yv28k5_N9fcBqCu1KO3tfUigl9fTKf00xdVF@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi!

PG8,4, Window XP, Python.

I have a program that makes many picture version from an original with XNView effects.
Because I want preserve the integrity, previous datas, I used transactions, and PGSQL.

The main problem with blobs that insertion is good, the select is good, but the deletion is very slow.

I had 300 MB source, and 4 GB database with effect-converted images.
The table was:
blobs(id integer, file_id integer, ext char(3), size integer, blob bytea)
with primary key, and some index on file_id, ext, size.

But these indexes not matter, when I stored the blobs in the picture table in fields, I also got this problem.

Extremely slow - this meaning that I started a query that do:

delete * from blobs where file_id in ()

(file_id have index, and select is very fast on it). 

And I need to wait 2 hours for the deletion, and 1 hours for vacuum... :-(

I tried with PySQLite also. The deletion is also slow, but it was 30 minutes only, but compact was 1 hours process...

Ok, I know that better to store blobs in other ways, but I want to preserve the integrity, and anydbm (for example) is does not browsable, etc...

Prev. I tried with Text fields (and with Hexlify), but it was also slow. So something is basically wrong with blobs, or blob deletion...

Thanks for your help:
   dd



pgsql-general by date:

Previous
From: Ravi Katkar
Date:
Subject: Re: Transaction with in function
Next
From: Jaime Casanova
Date:
Subject: Re: Commit every N rows in PL/pgsql