How to specify/mock the statistic data of tables in PostgreSQL - Mailing list pgsql-general

From ygnhzeus
Subject How to specify/mock the statistic data of tables in PostgreSQL
Date
Msg-id 52CFB699.2030609@gmail.com
Whole thread Raw
Responses Re: How to specify/mock the statistic data of tables in PostgreSQL  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-general

Hi all,

I want to use PostgreSQL to help me calculate the cardinality/selectivity of some queries, but I do not want to insert any data into these tables(since the data size is huge) to PostgreSQL. So I plan to calculate the statistic data by myself (not in PostgreSQL) and manually specify the metrics (maybe by modifying pg_statistic table) in PostgreSQL, thus PG's optimizer may use these statistic to evaluate the query (Explain...). Here comes the problem:

 

1. Is it possible to do what I've described above?

2. I've took a look at the pg_statistic table and pg_stats view, in the view I saw that most_common_elems/most_common_elem_freqs/elem_count_histogram were empty, and I'm also a little confused about the column called correlation. Is there any detailed document about how these metrics are calculated in PostgreSQL?

 

Thanks!

 

pgsql-general by date:

Previous
From: Sameer Kumar
Date:
Subject: Re: argument of CASE/WHEN must not return a set
Next
From: Luca Ferrari
Date:
Subject: Re: wal archive peak during pg_dump