Subject Re: [firebird-support] Update take hours to delete records :(
Author Thomas Steinmaurer
> 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

How many records approx.?

> 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 ...)

By using isc_tpb_no_rec_version you basically disable Firebird's MVCC
capabilities, so you explicitly tell Firebird to not use the back-record
version mechansim when changing/deleting data. This beams you back into
the good old days of MS SQL Server 2000 in read/write scenarios. ;-)

Additionally, you also might take garbage collection into account for
both, record data and index entries.

You may inspect MON$RECORD_STATS for getting some counters on if garbage
collection is performed. The Trace API gives you that information per
executed statement as well ...


--
With regards,
Thomas Steinmaurer (^TS^)
Firebird Technology Evangelist

http://www.upscene.com/

Do you care about the future of Firebird? Join the Firebird Foundation:
http://www.firebirdsql.org/en/firebird-foundation/



> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>