Re: Very slow 101-feeling design/query.. - Mailing list pgsql-admin

From Rui DeSousa
Subject Re: Very slow 101-feeling design/query..
Date
Msg-id 351E9FBA-1FF4-4A7B-BD78-ED60F36BA7F7@crazybean.net
Whole thread Raw
In response to Very slow 101-feeling design/query..  (Wells Oliver <wells.oliver@gmail.com>)
List pgsql-admin


On Dec 10, 2021, at 5:53 PM, Wells Oliver <wells.oliver@gmail.com> wrote:

SELECT DISTINCT game_id FROM vw_joints

Seeing distinct makes me cringe; most uses of it foreshadow either a poor design or a bad query; not always but more often than not.

If you’re really trying to do a distinct you can select from the game table and do an exists against plays and joints tables thus removing the distinct clause; but I digress as the given query is most likely an over simplified query just as example.

Partitioning does nothing here as the query doesn’t filter on the partitioned field thus no partition elimination.


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Very slow 101-feeling design/query..
Next
From: "Michel SALAIS"
Date:
Subject: RE: Very slow 101-feeling design/query..