Statistics Injection

From: Victor Giannakouris - Salalidis <victorasgs(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Statistics Injection
Date: 2016-07-02 07:35:08
Message-ID: CALUSaSqG8CQN-hp+GDgH6WAM+E4JuiNeXOvQM9-ea2hz6HvVxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

For some research purposes, I am trying to modify the existing statistics
of some tables in the catalogs in order to change the execution plan,
experiment with the EXPLAIN call etc.

Concretely, what I'd like to do is to create a "fake" table with a schema
of my choice (that's the easy part) and then modify the
statistics(particularly, the number of tuples and the number of pages).

Firstly, I create an empty table (CREATE TABLE newTable(....)) and then I
update the pg_class table as well (UPDATE pg_class SET relpages = #pages
WHERE relname='newTable').

The problem is that, even if I set the reltuples and relpages of my choice,
when I run the EXPLAIN clause for a query in which the 'newTable' is
involved in (e.g. EXPLAIN SELECT * FROM newTable), I get the same cost and
row estimation.

Could anyone help me with that?

Thank you in advance,

Victor Giannakouris

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-07-02 10:27:16 Re: Bug in batch tuplesort memory CLUSTER case (9.6 only)
Previous Message Amit Kapila 2016-07-02 06:08:36 Re: Re: [ADMIN] problems using pg_start_backup/pg_stop_backup and pg_basebackup at same time