Skip site navigation (1) Skip section navigation (2)

Re: very slow update query

From: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>
To: Ilija Vidoevski <ilija(dot)vidoevski(at)yahoo(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: very slow update query
Date: 2012-07-30 18:04:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

Ilija Vidoevski <ilija(dot)vidoevski(at)yahoo(dot)com> hat am 30. Juli 2012 um 19:50

> I need to update one table in my database with simple code
>  This is the script
>   update finarh
>   set vid = left(nalog,1)
>  Table has 177714 rows.
>  First execution time was : 00:02:39 minutes
>  Repeated execution time: 00:01:03 minutes.
>  Explain query plan is:
>  "Update on finarh  (cost=0.00..12049.99 rows=177714 width=172)"
>  "  ->  Seq Scan on finarh  (cost=0.00..12049.99 rows=177714 width=172)"
>  Why execution time is so loooong ?

The database rewrite the whole table, 177 thousand records, this takes some

Why you are doing that? the column vid are redundant, you should better use
select left(nalog,1) as vid and drop that vid-column from the table.

Regards, Andreas


In response to


pgsql-novice by date

Next:From: Ilija VidoevskiDate: 2012-07-30 18:22:33
Subject: Re: very slow update query
Previous:From: Ilija VidoevskiDate: 2012-07-30 17:50:53
Subject: very slow update query

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group