Subject Re: [firebird-support] Updating performace using IN or separated UPDATES
Author Alexandre Benson Smith
At 13:47 02/04/2004 -0300, you wrote:

>Hi,
>
>I was updating a table with a large number of records and I found something
>interesting
>
>if i do the update like this:
>
>update TABLE set
> <...etc...>
>where FIELD1 = X and FIELD2 in (1,2,3)
>
>I get a response time of 1 minute and 40 seconds.
>
>If I do three separated updates, like:
>
>update TABLE set
> <...etc...>
>where FIELD1 = X and FIELD2= 1;
>
>update TABLE set
> <...etc...>
>where FIELD1 = X and FIELD2 = 2;
>
>update TABLE set
> <...etc...>
>where FIELD1 = X and FIELD2 = 3;
>
>it executes in 17 seconds
>
>
>What is the reason to such difference if the number of reads in the table
>are the same?
>
>(PS: There can be only one line in TABLE for FIELD1 to a value of FIELD2
>(example (FIELD1= X and FIELD2 = 1) or (FIELD1= X and FIELD2 = 2) or
>(FIELD1= X and FIELD2 = 3)).

Hi Filipe

How much is a large number of records ?

If you send de plan for the queries we could explain why one is slower then
the other...

Diferent plans diferent execution times...

See you !


Alexandre Benson Smith
Development
THOR Software e Comercial Ltda.
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.631 / Virus Database: 404 - Release Date: 17/03/2004


[Non-text portions of this message have been removed]