Subject | Re: [firebird-support] Inserting 100's of thousands from a SP |
---|---|
Author | Ivan Prenosil |
Post date | 2005-07-08T13:44:14Z |
It is just result of the fact that uncommitted data are not visible
to other transactions. (or that committed data are not visible
to shapshot transactions started before that commit).
The only way how the server can decide whether particular
record version is visible to your transaction is to look
at that record version.
E.g. let's have empty table, insert 700,000 records but do not commit.
Now if the other transaction executes
SELECT FIRST 1 * FROM tab;
then although the result is empty set, the server has to look at all inserted
records and check their transaction id to realize that they are not visible
to your transaction.
You can observe the same effect even when using indexes with some
broad query, e.g.
SELECT * FROM tab WHERE ID<500000;
Because index does not contain transaction ids, a list of 500,000 records
is created internally, and they are all visited to find out which records
you can see (none in your case).
Ivan
to other transactions. (or that committed data are not visible
to shapshot transactions started before that commit).
The only way how the server can decide whether particular
record version is visible to your transaction is to look
at that record version.
E.g. let's have empty table, insert 700,000 records but do not commit.
Now if the other transaction executes
SELECT FIRST 1 * FROM tab;
then although the result is empty set, the server has to look at all inserted
records and check their transaction id to realize that they are not visible
to your transaction.
You can observe the same effect even when using indexes with some
broad query, e.g.
SELECT * FROM tab WHERE ID<500000;
Because index does not contain transaction ids, a list of 500,000 records
is created internally, and they are all visited to find out which records
you can see (none in your case).
Ivan