Re: Large CASE-statement is pretty slow?

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)nl>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Large CASE-statement is pretty slow?
Date: 2004-03-15 17:15:45
Message-ID: 87y8q22fr2.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Arjen van der Meijden <acmmailing(at)vulcanus(dot)its(dot)tudelft(dot)nl> writes:

>
> Of course I wanted to know how long it'd take on postgresql, selecting the
> pkey-field only (without the case) took also some 0.7 seconds (the entire table
> may have been more).
> But the CASE-version took 9026139.201 ms, i.e. over 9000 seconds about 8 times
> slower than MySQL.

Was this the select with the CASE, or the update?

If you did the update and have lots of foreign key references to the table
then every record that's updated forces a check to make sure there are no
references to that record (or an update if it's ON UPDATE CASCADE). If there
are no indexes on the referencing table columns that will be very slow.

--
greg

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Stark 2004-03-15 17:20:49 Re: Large CASE-statement is pretty slow?
Previous Message scott.marlowe 2004-03-15 15:57:25 Re: [PERFORM] syslog slowing the database?