Re: Understanding "seq scans" - Mailing list pgsql-general

From Kevin Grittner
Subject Re: Understanding "seq scans"
Date
Msg-id 1892463129.2775527.1444682099448.JavaMail.yahoo@mail.yahoo.com
Whole thread Raw
In response to Understanding "seq scans"  (Lele Gaifax <lele@metapensiero.it>)
List pgsql-general
On Monday, October 12, 2015 2:52 PM, Lele Gaifax <lele@metapensiero.it> wrote:

> I'm doing some experiments to find the better layout for
> reimplementing an existing db (MySQL cough!) with PostgreSQL
> 9.4+.
>
> I noticed a strange plan coming out from a simple query joining
> two tables, both containing 10Mrecs (and both ANALYZEd):

Your best bet to get good advice on this is to follow the steps
outlined here:

https://wiki.postgresql.org/wiki/SlowQueryQuestions

The short answer to the question of why it is picking those plans
is that that the optimizer looks at the various plans that can
generate correct results, and picks the one with the lowest
estimated cost based on your costing factors.  To get a plan more
like what you seem to be expecting you might need to adjust cost
factors or create an index that allows more direct access to the
data needed by the query.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Pattern match against array elements?
Next
From: Adrian Klaver
Date:
Subject: Re: Understanding "seq scans"