Re: [GENERAL] improvements/feedback sought for a working query that looks a bit ugly and might be inefficient - Mailing list pgsql-general

From jonathan vanasco
Subject Re: [GENERAL] improvements/feedback sought for a working query that looks a bit ugly and might be inefficient
Date
Msg-id 28FCE5B6-4A77-4EBE-8989-0E47C670DB79@2xlp.com
Whole thread Raw
In response to Re: [GENERAL] improvements/feedback sought for a working query thatlooks a bit ugly and might be inefficient  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] EnterpriseDB installed PostgreSQL 9.6 vs. REPMGR. Round4 - compilation issues on RHEL 7.2
Next
From: Melvin Davidson
Date:
Subject: Re: [GENERAL] Call for users to talk about table partitioning