Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

252
Views
Indexing over composite types in Postgres

Given the following, what can I expect of the resulting index?

CREATE TYPE instant AS (
    epoch_seconds timezonetz,
    nanos         integer
);

CREATE TABLE event AS (
    label      text,
    occurrence instant
);

CREATE INDEX idx_event_occurrence ON event (occurrence);

Will postgres automatically create a composite index over all the fields in instant? Would this index then use the left field as the primary and the right as the secondary? Would there be any reason to do the following instead?

CREATE INDEX idx_event_occurrence ON event (
    (occurrence).epoch_seconds,
    (occurrence).nanos
);
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!