Re: Faster distinct query?

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Israel Brewster <ijbrewster(at)alaska(dot)edu>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Faster distinct query?
Date: 2021-09-23 17:08:38
Message-ID: 13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would look into pre-loading the lookup table (and pre-emptive
maintenance).  Add the foreign key, but not the trigger.
>
> That makes sense. Thanks!
>
Yeah, then I got to wondering: Do you care?  Are these stations likely
to be spoofed?  You have the station id and type in you data table and
essentially the same in your lookup table.  If you're not replacing the
id+type in your data table with a lookup id you really don't need to
even have a foreign key.  Maybe sync them regularly but I'm not seeing
the value in the runtime overhead.  Now presumably the station table is
entirely pinned in memory and foreign key check might not be much
overhead but it won't be zero.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Geoff Winkless 2021-09-23 18:36:48 Re: Faster distinct query?
Previous Message rihad 2021-09-23 16:51:49 Re: Currently running queries with actual arguments?