Subject | Re: [firebird-support] Great variance in speed of an INSERT INTO ... SELECT |
---|---|
Author | Ann Harrison |
Post date | 2011-10-19T16:02:31Z |
Pepak,
databases that require a WHERE clause, but Firebird doesn't. But that's not
the problem.
The normal cause of wild variations in the performance of queries is garbage
collection. For example, if you did this query twice, deleting all rows in
backuptable, then resetting the generator backupgen to 1, the second run
would have to remove all the old rows and deleted stubs and clean up the
indexes (assuming that source_key is actually a unique key).
Good luck,
Ann
[Non-text portions of this message have been removed]
> I wonder - what could possibly cause a great variance in speeds of thisThe WHERE 1 = 1 is unnecessary, but doen't do any harm. There maybe
> statement?
>
> INSERT INTO backuptable (
> backup_key,
> original_key, original_value1, ..., original_valuen
> )
> SELECT GEN_ID(backupgen,1),
> source_key, source_value1, ..., source_valuen
> FROM sourcetable
> WHERE 1=1
databases that require a WHERE clause, but Firebird doesn't. But that's not
the problem.
The normal cause of wild variations in the performance of queries is garbage
collection. For example, if you did this query twice, deleting all rows in
backuptable, then resetting the generator backupgen to 1, the second run
would have to remove all the old rows and deleted stubs and clean up the
indexes (assuming that source_key is actually a unique key).
Good luck,
Ann
[Non-text portions of this message have been removed]