Re: Optimizing select count query which often takes over 10 seconds - Mailing list pgsql-general

From Alexander Farber
Subject Re: Optimizing select count query which often takes over 10 seconds
Date
Msg-id CAADeyWitdfbor4sF7wgRzc_VjQGvtGBrwx_PP09i9-o4tLocPw@mail.gmail.com
Whole thread Raw
In response to Re: Optimizing select count query which often takes over 10 seconds  (Jeff Janes <jeff.janes@gmail.com>)
Responses Re: Optimizing select count query which often takes over 10 seconds  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-general
Hello -

On Fri, Jan 25, 2013 at 7:42 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
> On Thu, Jan 24, 2013 at 1:57 AM, Alexander Farber
> <alexander.farber@gmail.com> wrote:
>>
>> LOG:  duration: 12590.394 ms  statement:
>>         select count(id) from (
>>             select id,
>>                    row_number() over(partition by yw order by money
>> desc) as ranking
>>             from pref_money
>>         ) x
>>         where x.ranking = 1 and id='OK471018960997'
>
> This sounds like a good idea.  But if the tournament is weekly why
> would the job have to be hourly?  Why do the results of a weekly
> tournament need to be 'live'?

because for the current week
the medals are displayed too.

And when a player enters a top
then he should get +1 medals and
the one he pushed from the top -1 medals

So even hourly isn't really good enough for me...
It should be "live" stats.

Regards
Alex


pgsql-general by date:

Previous
From: Jon Smark
Date:
Subject: Best approach for query with optional constraints
Next
From: Jeff Janes
Date:
Subject: Re: Finding common hstore key=>value pairs with hstore