> Is one of those estimates way off reality, or is it only the conjunction which is deranged?
The estimate is wrong *even with a single tag*, without the conjunction (e.g. expected 3500, actual 20). Then the conjunction can make the bias even worse...
On Sun, Feb 02, 2020 at 03:18:19PM +0100, Marco Colli wrote: > Hello! > > Let's say that you have a simple query like the following on a large table > (for a multi-tenant application): > SELECT "subscribers".* FROM "subscribers" WHERE "subscribers"."project_id" > = 123 AND (tags @> ARRAY['de']::varchar[]); > > If you run EXPLAIN ANALYZE you can see that stats are completely wrong. > For example I get an expected count of 3,500 rows whereas the actual > result is 20 rows. This also results in bad query plans...