pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Israel Brewster <ijbrewster@alaska.edu>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Faster distinct query?
Date: Thu, 23 Sep 2021 11:08:38 -0600
Message-ID: <13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com> (raw)
In-Reply-To: <D24DD0D6-B126-4433-85E9-3082A12286BF@alaska.edu>
References: <0BB059BF-54BD-46FA-8B26-28FEF9A04198@alaska.edu>
	<20210923070435.GB8425@depesz.com>
	<CADyMnEzz2QQJu1J9tDCO36HSrsGCpa1o3Lg1wDQCW_i-ShRt9Q@mail.gmail.com>
	<0BAB9A86-3C6B-4591-B557-27501919843E@alaska.edu>
	<670727da-f703-bbd3-f239-9e208130b1f0@gmail.com>
	<D24DD0D6-B126-4433-85E9-3082A12286BF@alaska.edu>

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.





view thread (34+ messages)  latest in thread

Message-ID: <13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com>
Permalink:  ../13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com/
Also on:    postgresql.org/message-id/13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com, ijbrewster@alaska.edu
  Subject: Re: Faster distinct query?
  In-Reply-To: <13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com>
  References: <0BB059BF-54BD-46FA-8B26-28FEF9A04198@alaska.edu> <20210923070435.GB8425@depesz.com> <CADyMnEzz2QQJu1J9tDCO36HSrsGCpa1o3Lg1wDQCW_i-ShRt9Q@mail.gmail.com> <0BAB9A86-3C6B-4591-B557-27501919843E@alaska.edu> <670727da-f703-bbd3-f239-9e208130b1f0@gmail.com> <D24DD0D6-B126-4433-85E9-3082A12286BF@alaska.edu> <13e62549-ffa1-712e-39f4-cfc42aaf25e3@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox