Re: Optimizing select count query which often takes over 10 seconds

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Optimizing select count query which often takes over 10 seconds
Date: 2013-01-30 07:41:40
Message-ID: CAADeyWgROhMSNFDOhSZa+DC4uqLNfA2xL+0XH2D=LzyaC=1r1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Kevin,

On Wed, Jan 30, 2013 at 12:09 AM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> Alexander Farber <alexander(dot)farber(at)gmail(dot)com> wrote:
>
>> update pref_users set medals = 0;
>> UPDATE 223456
>
> You're probably going to like your performance a lot better if you
> modify that to:
>
> update pref_users set medals = 0 where medals <> 0;

is it really so?

I only have 65 users (out of 223456) with medals != 0.

When programming other languages, I never do
if (x != 0) { x = 0; } but just set x = 0 straight away.

Regards
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bartosz Dmytrak 2013-01-30 07:57:55 Re: Fwd: Functions not visible in pg_stat_user_functions view
Previous Message Alexander Law 2013-01-30 06:00:01 Re: BUG #7493: Postmaster messages unreadable in a Windows console