ovember 22, 2017 4:02 PM
To: Artur Zając
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Bad estimates
=?iso-8859-2?Q?Artur_Zaj=B1c?= writes:
[ poor estimates for WHERE clauses like "(gs & 1) = 1" ]
Don't hold your breath waiting for that to get better on its own.
You
Artur Zając wrote:
> We have table created like this:
>
> CREATE TABLE xyz AS SELECT generate_series(1,1000,1) AS gs;
>
> Now:
>
> explain analyze select * from xyz where gs&1=1;
> Seq Scan on xyz (cost=0.00..260815.38 rows=68920 width=4)
> (actual time=0.044..2959.728 r
rmance@lists.postgresql.org
Subject: Re: Bad estimates
I'm assuming you never analyzed the table after creation & data load? What does
this show you:
select * from pg_stat_all_tables where relname='xyz';
Don.
--
Don Seiler
www.seiler.us <http://www.seiler.us>
=?iso-8859-2?Q?Artur_Zaj=B1c?= writes:
[ poor estimates for WHERE clauses like "(gs & 1) = 1" ]
Don't hold your breath waiting for that to get better on its own.
You need to work with the planner, not expect it to perform magic.
It has no stats that would help it discover what the behavior of
tha
On Wed, Nov 22, 2017 at 03:29:54PM +0100, Artur Zając wrote:
> CREATE TABLE xyz AS SELECT generate_series(1,1000,1) AS gs;
>
> db=# explain analyze select * from xyz where gs&1=1;
> Seq Scan on xyz (cost=0.00..260815.38 rows=68920 width=4) (actual
> time=0.044..2959.728 rows=500 loops=1
I'm assuming you never analyzed the table after creation & data load? What
does this show you:
select * from pg_stat_all_tables where relname='xyz';
Don.
--
Don Seiler
www.seiler.us
Hi,
We have table created like this:
CREATE TABLE xyz AS SELECT generate_series(1,1000,1) AS gs;
Now:
db=# explain analyze select * from xyz where gs&1=1;
QUERY PLAN
--