Indexes for inequalities

Поиск
Список
Период
Сортировка
От Stephen Froehlich
Тема Indexes for inequalities
Дата
Msg-id CY1PR0601MB1210EFB80DBB4E0B3F89934EE5B30@CY1PR0601MB1210.namprd06.prod.outlook.com
обсуждение исходный текст
Ответы Re: Indexes for inequalities  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice

Hi All,

 

I am creating an intersect table where I have a relationship that is true for a period of time and then a series of observations, so we’re looking at something like:

 

SELECT * FROM

 

observations

INNER JOIN

relationships

ON (observations.id = relationships.id AND observations.time >= relationships.time_from AND observations.time < relationships.time_to)

 

How do I best build indexes on “relationships”, which is a few hundred thousand lines in length for a fast join?  Do I build one on all three columns (id, time_from, time_to) or three separate indexes for each column or some other combo? It’s a small enough table where space isn’t a worry, but speed will be as “observations” is several terabytes in size.

 

This is PostgreSQL 10, so we can CREATE STATISTICS, but the id, is an md5 (its hashed data), so it is therefore completely orthogonal on its own.

 

Thanks,

Stephen


Stephen Froehlich
Sr. Strategist, CableLabs®


s.froehlich@cablelabs.com

Tel: +1 (303) 661-3708

 

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Amit S."
Дата:
Сообщение: Re: dual active 2-node cluster?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Indexes for inequalities