hi all,

During the execution of the following requests, INSERT does not finish except if it is carried out a few minutes after the
creation of the table. How to explain this latency time?

CREATE produces a table with the number of events of a product (id1) for a customer (id2) having attribute “ABCD”.
INSERT adds a row for each product a client did not buy whereas others of group "ABCD" did. That is done by selecting the
Cartesian product between the attributes id1 and id2 then removing (EXCEPT) lines whose couple (id1, id2) is already in…

-----------------------------------------
drop table maTable;

create table maTable as (
select id1,id2,count(*)
from table1
where cle = 'ABCD'
group by id1, id2
order by id2,id1);

insert into maTable (select * from
((select a.id1 ,b.id2 ,0
from maTable a, maTable b
group by a.id1,b.id2
order by b.id2,a.id1)
EXCEPT
(select c.id1 ,c.id2 ,0
from maTable c
))as tt;
-----------------------------------------

DROP and CREATE do their job but INSERT does not finish if it is carried out immediately after the CREATE. On the other hand

if it is carried out a few minutes (~5min) later then INSERT commits in a few seconds.

Rq: If drop/create/insert is replaced by delete/insert/insert then it's ok.
Finally the creation of a “Temporary” table leads to the same problem.   

Thank you for your assistance,

Mat