INSERT does not finish except if it is carried out a few minutes after the creation of the table

From: Matthieu Guamis <matthieu(dot)guamis(at)axege(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: INSERT does not finish except if it is carried out a few minutes after the creation of the table
Date: 2006-09-12 12:09:40
Message-ID: 4506A384.4000900@axege.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Trebuchet MS">hi all,<br>
<br>
During the execution of the following requests, INSERT does not finish
except if it is carried out a few minutes after the <br>
creation of the table. How to explain this latency time?<br>
<br>
CREATE produces a table with the number of events of a product (id1)
for a customer (id2) having attribute &#8220;ABCD&#8221;. <br>
INSERT adds a row for each product a client did not buy whereas others
of group "ABCD" did. That is done by selecting the <br>
Cartesian product between the attributes id1 and id2 then removing
(EXCEPT) lines whose couple (id1, id2) is already in&#8230; <br>
<br>
-----------------------------------------<br>
drop table maTable;<br>
<br>
create table maTable as (<br>
select id1,id2,count(*)<br>
from table1<br>
where cle = 'ABCD'<br>
group by id1, id2<br>
order by id2,id1);<br>
<br>
insert into maTable (select * from<br>
((select a.id1 ,b.id2 ,0<br>
from maTable a, maTable b<br>
group by a.id1,b.id2<br>
order by b.id2,a.id1)<br>
EXCEPT<br>
(select c.id1 ,c.id2 ,0<br>
from maTable c<br>
))as tt;<br>
-----------------------------------------<br>
<br>
DROP and CREATE do their job but INSERT does not finish if it is
carried out immediately after the CREATE. On the other hand <br>
<br>
if it is carried out a few minutes (~5min) later then INSERT commits in
a few seconds. <br>
<br>
Rq: If drop/create/insert is replaced by delete/insert/insert then it's
ok.<br>
Finally the creation of a &#8220;Temporary&#8221; table leads to the same
problem.&nbsp;&nbsp;&nbsp; <br>
<br>
Thank you for your assistance,<br>
<br>
Mat<br>
</font></font><br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 1.8 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sergiusz Jarczyk 2006-09-12 13:19:50 Re: off topic - web shop
Previous Message Tomi NA 2006-09-12 11:22:28 Re: [pgsql-advocacy] Thought provoking piece on

Browse pgsql-novice by date

  From Date Subject
Next Message Sree Narayana 2006-09-12 14:28:33 Problme in my pg_dump command
Previous Message pr0v4 2006-09-12 09:30:54 Passing arguments