tom wrote: > I found a problem with my application which only occurs under > high loads (isn't that always the case?). > > insert into tokens (token) > select [...] > > This works 99% of the time. > > But everyone once in a long while it seems that I hit simultaneaous > execute() statements that deadlock on the insertion.
The SELECT statement will not request a row lock and consequently very likely has nothing to do with the deadlock. That leaves only the INSERT itself. What is the table definition of "tokens" (with indexes and constraints)? Is there concurrent database activity of any kind? What is the scope of the transaction that contains the INSERT statement - does it contain multiple INSERT statements? Other statements as well? Yours, Laurenz Albe ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match