Re: Partial index plan/cardinality costing

2018-10-08 Thread Justin Pryzby
Please don't cross-post to lists. >insert into s(status, action_at, m_fk) >select > ( CASE WHEN series.n % 100 < 80 THEN > (ARRAY['E', 'C'])[(series.n % 2) + 1] >ELSE > (ARRAY['P', 'PD', 'A'])[((random() * 3)::integer % 3) + 1] >END > ), > ( >CASE WHEN series.n % 100 < 80

Re: Partial index plan/cardinality costing

2018-10-08 Thread James Coleman
Bump, and curious if anyone on hackers has any ideas here: of particular interest is why the (pk, created_at) index can possibly be more valuable than the (created_at, pk) variant since the former effectively implies having to scan the entire index. On Fri, Sep 7, 2018 at 12:17 PM James Coleman wr

Partial index plan/cardinality costing

2018-09-07 Thread James Coleman
I have the following tables: - m(pk bigserial primary key, status text): with a single row - s(pk bigserial primary key, status text, action_at date, m_fk bigint): * 80% of the data has action_at between the current date and 1 year ago and status of E or C * 20% of the data has action_at b