Organizing large child tables & indexes for quick seeking

From: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Organizing large child tables & indexes for quick seeking
Date: 2018-07-30 17:55:05
Message-ID: CAOC+FBUOxb-HpYVinF8ZtnH8jCXv+b2Mn4h8r8YsXfrh_GbSTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I have a parent table which at the moment has 140 child tables, each
partitioned by year and week (named table_yr2018_wk25, etc). Each child
table has something like 80-100m rows.

Querying from the parent table can be a hit or miss operation: sometimes
the planner does a sequence scan over each child table and its millions of
rows (which of course never completes) and sometimes it uses an index: I
have an index on each child table which is comprised of 5 columns,
including week and year.

The PK on the parent table is a uuid.

Any tips here for ensuring a faster seek to the appropriate child table?
Should I make an index that just has week/year?

--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Geoghegan 2018-07-30 22:53:00 Re: Fwd: Problem with a "complex" upsert
Previous Message Tom Lane 2018-07-30 14:48:45 Re: Table's REPLICATE IDENTITY : where is it kept?