Re: How to release locks - Mailing list pgsql-general

From Andrus
Subject Re: How to release locks
Date
Msg-id dvrtjv$upl$1@news.hub.org
Whole thread Raw
In response to Re: How to release locks  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
Responses Re: How to release locks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
>> A cancel signal was sent to the selected server process(es).
>> However, process continues running.
>
> What's it doing exactly?

Client was killed when it waits a 2 MB bytea string insert statement to be
completed inside transaction:

INSERT INTO localfil (filename,filedirect,BlockNumber,lastchange,contents)
     values( 'alguss.exe', 'algus', 1,CURRENT_TIMESTAMP, decode(
'1mbbinarystring', 'hex') );

odbc driver was in progress of sending data using libpq when client was
terminated.

> We recently fixed some places in btree index creation where the thing
> could run for a long time before noticing a cancel interrupt.  Maybe
> you've found another one.

localfil table is empty before insert (it has large bytea fields but all
rows are deleted before repro). So index (primary key) is single row.

Can it happen that  process running 2 mb bytea insert command will take
extremely long time to interrupt ?
Or will decode() function take long time to interrupt ?
There is also before insert or update trigger, maybe this influences ?
I'm currently uploading files using 1 mb binary data which are converted to
a 2 MB hex strings before uploading through odbc.

File is uploaded, stored and downloaded using localfil table in a number of
records each containing 1 MB of data.

Is it more reasonable to use smaller blocks to load and store files ?

Andrus.

My table strucure is

CREATE TABLE public.localfil (
Filename CHAR(50),
FileDirect CHAR(8),
BlockNumber INTEGER,
lastchange timestamp NOT NULL,
Contents BYTEA NOT NULL,
PRIMARY KEY ( Filename, FileDirect, BlockNumber )
);

CREATE TRIGGER localfil_trig BEFORE INSERT OR UPDATE
ON localfil EXECUTE PROCEDURE setlastchange();



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to release locks
Next
From: Richard Jones
Date:
Subject: index for inet and >> (contains) function