Re: improvements/feedback sought for a working query that looks a bit ugly and might be inefficient

From: jonathan vanasco <postgres(at)2xlp(dot)com>
To: David G(dot) Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general general <pgsql-general(at)postgresql(dot)org>
Subject: Re: improvements/feedback sought for a working query that looks a bit ugly and might be inefficient
Date: 2017-05-18 18:50:16
Message-ID: 28FCE5B6-4A77-4EBE-8989-0E47C670DB79@2xlp.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 16, 2017, at 10:20 PM, David G. Johnston wrote:

> Unless you can discard the 5 and 1000 limits you are going to be stuck computing rank three times in order to compute and filter them.

Thanks a ton for your insight. I'm suck using them (5 is required for throttling, 1000 is required for this to run in a reasonable amount of time)

The overhead of computing things is indeed super small. I'm not really worried much about the performance of this query (it runs around 3ms now, down from 20+s). I'm more worried about this code being referenced and a (possibly improper) idiom being used on queries where it will have a noticeable effect.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2017-05-18 19:21:40 Re: Call for users to talk about table partitioning
Previous Message Adrian Klaver 2017-05-18 18:10:54 Re: EnterpriseDB installed PostgreSQL 9.6 vs. REPMGR. Round 4 - compilation issues on RHEL 7.2