Re: Complex filters -> Bad row estimates -> bad query plan

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Mathieu Fenniak <mathieu(dot)fenniak(at)replicon(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Complex filters -> Bad row estimates -> bad query plan
Date: 2019-08-21 23:05:11
Message-ID: CAHOFxGpnAX7x0s7sQ-mkNQVA3VQ7+65nOOFtU5mOLy_tk=k1Jg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-- I'm thinking the OFFSET 0 create an optimization barrier that prevents
the planner from collapsing that sub-query into the top query, and enforces
ordering in the query?

That's my understanding. I think it is an optimizer hint by another name. I
used to put things in a CTE (which is always materialized until v12, which
will change it to inlined unless keyword MATERIALIZED is included) or I
would create a temp table if the dataset is expected to contain many rows
such that I can do ANALYZE pg_temp.table_table; so the optimizer has stats
to make good decisions.

Note- Replying to messages with a full quote of the conversation below your
comment (aka top-posting) is discouraged on these mailing lists. Please
quote the portion you are responding to and that's it.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2019-08-22 02:36:17 Re: Importing from CSV, auto creating table?
Previous Message DiasCosta 2019-08-21 22:45:51 Re: Importing from CSV, auto creating table?