Re: Use extended statistics to estimate (Var op Var) clauses

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use extended statistics to estimate (Var op Var) clauses
Date: 2021-08-11 22:02:29
Message-ID: 6F6757E6-73F1-44CC-9046-FF59DF37B16E@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 11, 2021, at 10:38 AM, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> wrote:
>
> So I'm a bit puzzled about the claim that random data make the problems more extreme. Can you explain?

Hmm... you appear to be right.

I changed the gentest.pl script to fill the tables with randomized data, but the random data is being regenerated each test run (since the calls to random() are in the gentest.sql file). Adding an explicit setseed() call in the test to make sure the data is the same before and after applying your patch eliminates the differences.

So there are three tests here. The first tests deterministic orderly data. The second tests deterministic random data without repeats and hence without meaningful mvc. The third tests deterministic random data with rounding into twenty buckets skewed towards lower numbered buckets and hence with both repeats and meaningful mvc.

The original test set:

TOTAL:
better: 77827
worse: 12317

The random test set, with setseed() calls to make it deterministic:

TOTAL:
better: 49708
worse: 19393

The random test set , with setseed() calls to make it deterministic plus rounding into buckets:

TOTAL:
better: 81764
worse: 19594

Once the data is made deterministic, the third set looks slightly better than the first, rather than slightly worse. But almost 20% of the query types still look worse after applying the patch. I'm going to dig deeper into those to see if that conclusion survives bumping up the size of the dataset. It will take quite some time to run the tests with a huge dataset, but I don't see how else to investigate this.


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-08-11 22:24:09 Re: Worth using personality(ADDR_NO_RANDOMIZE) for EXEC_BACKEND on linux?
Previous Message Melanie Plageman 2021-08-11 22:00:40 Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)