Re: Faster distinct query?

Поиск
Список
Период
Сортировка
Искать
От
Mladen Gogala
Тема
Re: Faster distinct query?
Дата
Msg-id
135cb451-c8d0-28ed-f563-0bd3bf2f2438@gmail.com
Ответ на
Re: Faster distinct query? (David G. Johnston)
Список
Дерево обсуждения
Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? hubert depesz lubaczewski <depesz@depesz.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Ryan Booz <ryan@timescale.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Rob Sargent <robjsargent@gmail.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Rob Sargent <robjsargent@gmail.com>
Re: Faster distinct query? Geoff Winkless <pgsqladmin@geoff.dj>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Michael Lewis <mlewis@entrata.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Michael Lewis <mlewis@entrata.com>
Re: Faster distinct query? David Rowley <dgrowleyml@gmail.com>
Re: Faster distinct query? "David G. Johnston" <david.g.johnston@gmail.com>
Re: Faster distinct query? Tom Lane <tgl@sss.pgh.pa.us>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Michael Lewis <mlewis@entrata.com>
Re: Faster distinct query? Tom Lane <tgl@sss.pgh.pa.us>
Re: Faster distinct query? David Rowley <dgrowleyml@gmail.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? David Rowley <dgrowleyml@gmail.com>
Re: Faster distinct query? "David G. Johnston" <david.g.johnston@gmail.com>
Re: Faster distinct query? David Rowley <dgrowleyml@gmail.com>
Re: Faster distinct query? Ryan Booz <ryan@timescale.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Ryan Booz <ryan@timescale.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Ryan Booz <ryan@timescale.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>
Re: Faster distinct query? Ryan Booz <ryan@timescale.com>
Re: Faster distinct query? "David G. Johnston" <david.g.johnston@gmail.com>
Re: Faster distinct query? Mladen Gogala <gogala.mladen@gmail.com>
Re: Faster distinct query? Israel Brewster <ijbrewster@alaska.edu>

On 9/22/21 16:20, David G. Johnston wrote:
> I'd probably turn that index into a foreign key that just ensures that 
> every (station,channel) that appears in the data table also appears on 
> the lookup table.  Grouping and array-ifying the lookup table would be 
> trivial.  Either modify the application code or add a trigger to 
> populate the lookup table as needed.


I fully agree with this. Adding a trigger to populate a lookup table is 
a standard design in situations like this. Using "DISTINCT" almost 
always spells trouble for the performance.


-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com



В списке pgsql-general по дате отправления
От: Ryan Booz
Дата:
Сообщение: Re: Faster distinct query?
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: Faster distinct query?
FAQ