Re: strange pg_stats behaviour? - Mailing list pgsql-general

From Tom Lane
Subject Re: strange pg_stats behaviour?
Date
Msg-id 195.1038672301@sss.pgh.pa.us
Whole thread Raw
In response to Re: strange pg_stats behaviour?  (Hubert depesz Lubaczewski <depesz@depesz.pl>)
Responses Re: strange pg_stats behaviour?  (Hubert depesz Lubaczewski <depesz@depesz.pl>)
List pgsql-general
Hubert depesz Lubaczewski <depesz@depesz.pl> writes:
>> The planner doesn't know what value data_off will be compared to at
>> runtime, so it has to fall back on a default selectivity estimate.

> strange - is there no way we can "teach" him, that this is a constant. i
> mean now() - '31 days'::interval will be exactly the same for all rows
> of auction,

It knows that.  What it doesn't know is how many rows of the table the
query is going to select, and that is exactly the thing it needs to know
to choose seqscan vs. indexscan.

            regards, tom lane

pgsql-general by date:

Previous
From: Christoph Dalitz
Date:
Subject: Re: ALTER TABLE & COLUMN
Next
From: "Han Holl"
Date:
Subject: Re: Memory leak with palloc