Subject | Update take hours to delete records :( |
---|---|
Author | nathanelrick |
Post date | 2012-02-28T15:03:59Z |
Hello,
I have a table that i use to store session
Table Session
ID: VARCHAR(16); /* GUID ID */
Expiry_date: Timestamp;
Data: Varchar(1000);
i use the table like this only :
Insert into Session(ID,Expiry_date,Data)
VALUES (CHAR_TO_UUID(NewGUID), NOW + 15minutes,...)
Update Session Set
data=...
Expiry_date= NOW + 15minutes
where
id=... and
Date_expired < 'NOW'
Select ... from SESSION where
ID=... and Expiry_date > 'NOW'
THat ok,
now the probleme is that i have another thread that one time a day delete all the expired node
Delete From SESSION where Expiry_date < NOW - 3 days
i use isc_tpb_write + isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_wait for this second thread (but normally as i delete the rec that expire 3 days ago they must not be any probleme of deadlock)
but the probleme is that this SQL make hours (days?) to return :(
if i replace the isc_tpb_wait by isc_tpb_nowait then i have often some deadlock (why ?? still not understand ...)
I have a table that i use to store session
Table Session
ID: VARCHAR(16); /* GUID ID */
Expiry_date: Timestamp;
Data: Varchar(1000);
i use the table like this only :
Insert into Session(ID,Expiry_date,Data)
VALUES (CHAR_TO_UUID(NewGUID), NOW + 15minutes,...)
Update Session Set
data=...
Expiry_date= NOW + 15minutes
where
id=... and
Date_expired < 'NOW'
Select ... from SESSION where
ID=... and Expiry_date > 'NOW'
THat ok,
now the probleme is that i have another thread that one time a day delete all the expired node
Delete From SESSION where Expiry_date < NOW - 3 days
i use isc_tpb_write + isc_tpb_read_committed + isc_tpb_no_rec_version + isc_tpb_wait for this second thread (but normally as i delete the rec that expire 3 days ago they must not be any probleme of deadlock)
but the probleme is that this SQL make hours (days?) to return :(
if i replace the isc_tpb_wait by isc_tpb_nowait then i have often some deadlock (why ?? still not understand ...)