Subject Re: [firebird-support] Re: DB-Inserts slow after 5000 inserts (with select)
Author Helen Borrie
At 11:05 AM 15/06/2011, Ann Harrison wrote:
>Jens,
>
>>> Example: SELECT id From PLAYER WHERE name='thename'
>>>
>>> If no record exists and the id returned is 0 i'm inserting the data.
>>>
>>> After 5000 inserts the inserts getting slow. I start with 2000 records
>>> in 10 seconds, after 5000 inserts it slows down to 100 records in 10
>>> seconds.
>
>
>You need an index on PLAYERNAME, or you need to make PLAYERNAME
>the first item in the unique constraint UNQ1_PLAYER. Firebird cannot use
>the second or subsequent columns in an index unless it has values for all
>the preceding columns.

As Ann suggests....also consider the UPDATE OR INSERT syntax if you are using Firebird 2.1 or higher (but *still* improve that index!)

./heLen