Re: very slow update query - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: very slow update query
Date
Msg-id 77687306.70255.1343671490340.JavaMail.open-xchange@ox.ims-firmen.de
Whole thread Raw
In response to very slow update query  (Ilija Vidoevski <ilija.vidoevski@yahoo.com>)
List pgsql-novice



Ilija Vidoevski <ilija.vidoevski@yahoo.com> hat am 30. Juli 2012 um 19:50
geschrieben:


> 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
time...

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

>
>

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.4.12 log truncation not working?
Next
From: Ilija Vidoevski
Date:
Subject: Re: very slow update query