Re: :Posgres - performance problem

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: :Posgres - performance problem
Date: 2015-03-25 18:59:19
Message-ID: 55130587.9050002@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/25/2015 2:19 AM, ginkgo36 wrote:
> Hi all,
> I have 1 table have:
> - 417 columns
> - 600.000 rows data
> - 34 indexs
>
> when i use query on this table, it so long. ex:
>
> update master_items set
> temp1 = '' where temp1 <> '' --Query returned successfully: 435214 rows
> affected, 1016137 ms execution time.

that query is modifying 435000 rows of your table, and if temp1 is an
indexed field, the index has to be updated 435000 times, too.

note that in postgres, a 'update' translates into a INSERT and a DELETE

> alter table master_items add "TYPE-DE" varchar default ''
> -- Query returned successfully with no result in 1211019 ms.

that is rewriting all 600000 rows, to add this new field with its
default empty string content

> update master_items set "feedback_to_de" = 'Yes'
> --Query returned successfully: 591268 rows affected, 1589335 ms execution
> time.

that is modifying 591000 rows, essentially rewriting the whole table.

> Can you help me find any way to increase performance?

more/faster storage. faster CPU. more RAM.

or, completely rethink how you store this data and normalize it as
everyone else has said.

--
john, recycling bits in santa cruz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Boyle 2015-03-25 22:02:54 Setting up BDR 0.9.0 - error on bdr_group_create
Previous Message John McKown 2015-03-25 17:25:38 OT? Turing Award goes to one of original authors of proto-PostgreSQL