Subject savepoints limit
Author kaczy27
Hi,

I created a transaction, did some queries, set savepoint, did
another set of queries, set savepoint and so on
after this quite long transaction I commited all.

sidenote: this is not standard operation, it is done once per
application setup (when the database is idle, no other connections,
so this is not a heavy duty, many transactions problem.
sidenote2: I am not doing any DDL within the transaction, pure
Selects/inserts

I experienced that at some point (i can't precisely define when) I
start to receve strange exceptions.

I found out that RELEASING SAVEPOINTS at the end of queries block
(in the middle of the job regardless of commit at the end of the
batch) helped with this issue.

scenario:
begin, fill table t1, set savepoint, fill related records in t2,
release savepoint, set another, fill another set of related records
in t2, release savepoint, commit transaction.

Today I hit the problem again, this time I am releasing as I go, but
I receive some strange results. (ie. the exact same procedure, give
different results when called from different levels of the same
transaction).

I read through doc about savepoints and the only clue I find is the
limit around 10^4 recoerds affected.
I don't think that I hit that amount within single transaction.
How many savepoints can be set without commit. (how many levels deep
can the transaction be)

Can I safely read from records I inserted in current transaction but
some levels before possible after few partial commits (savepoints
releases)? I know I should not update the same record multiple times
within the same transaction. I am not doing this, but what could be
the consequences, is it defined as no (if so why there is no
exception from Firebird) or it only bails out under some
circumstances (what are those if so).

Thanks (for reading at least ;) )
CUIN Kaczy

ps. technote: winXP service pack 2, firebird 1.5.1 SS, connecting
via .NET provider