Statistics Injection - Mailing list pgsql-hackers

From Victor Giannakouris - Salalidis
Subject Statistics Injection
Date
Msg-id CALUSaSqG8CQN-hp+GDgH6WAM+E4JuiNeXOvQM9-ea2hz6HvVxg@mail.gmail.com
Whole thread Raw
Responses Re: Statistics Injection  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Statistics Injection  (Vladimir Sitnikov <sitnikov.vladimir@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Re: [ADMIN] problems using pg_start_backup/pg_stop_backup and pg_basebackup at same time
Next
From: Jim Nasby
Date:
Subject: Re: Bug in batch tuplesort memory CLUSTER case (9.6 only)