pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mauricio Fernandez A. <mfacontacto@ono.com>
To: pgsql-sql@postgresql.org
Subject: Re: Slow update SQL
Date: Wed, 1 Mar 2006 11:17:15 +0100
Message-ID: <CMEIKGCPKOPCGFKCNHLDCEKLCDAA.mfacontacto@ono.com> (raw)
In-Reply-To: <040c01c63b47$66440b50$0200a8c0@server>

You can try this too:

...
WHERE EXTRACT(YEAR FROM dxdate::Date) > 2000



Mauricio Fernández A.
Ingeniero de Sistemas
Universidad Autónoma de Manizales (Colombia)



-----Mensaje original-----
De: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]En nombre de Bungsuputra Linan
Enviado el: lunes, 27 febrero, 2006 3:42
Para: ken@scottshill.com; Postgres Help
Asunto: Re: [SQL] Slow update SQL


Hi Ken,

I used to have the same problem. In my computer, using date_part in WHERE
clause will always slow down the system when the table has plenty of rows.

My suggestion is try to change the query to:
... WHERE dxdate >= '2001-01-01';

I hope this helps.

Regards,
bungsu

----- Original Message -----
From: Ken Hill
To: Postgres Help
Sent: Tuesday, February 14, 2006 8:48 AM
Subject: [SQL] Slow update SQL


I'm experiencing a very slow query. The table contains 611,564 rows of data.
I vaccumed the table:

VACUUM ANALYZE ncccr10;

SELECT count(*) FROM ncccr10;
count
--------
611564
(1 row)

When I try to analyze the query plan with:

EXPLAIN ANALYZE
UPDATE ncccr10
SET key = facilityno||'-'||
lastname||'-'||
sex||'-'||
ssno||'-'||
birthdate||'-'||
primarysit||'-'||
dxdate||'-'||
morphology3
WHERE date_part('year',dxdate) > '2000';

The query just never finishes (even 1 hour later). The colum key100 is
indexed, and I'm setting the value of this
column from other columns. Why is this so slow?


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

view thread (8+ messages)

Message-ID: <CMEIKGCPKOPCGFKCNHLDCEKLCDAA.mfacontacto@ono.com>
Permalink:  ../CMEIKGCPKOPCGFKCNHLDCEKLCDAA.mfacontacto@ono.com/
Also on:    postgresql.org/message-id/CMEIKGCPKOPCGFKCNHLDCEKLCDAA.mfacontacto@ono.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mfacontacto@ono.com
  Subject: Re: Slow update SQL
  In-Reply-To: <CMEIKGCPKOPCGFKCNHLDCEKLCDAA.mfacontacto@ono.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox