"Sidar Lopez Cruz" <sidarlopez@hotmail.com> wrote:
> can statistics help the postgresql performance? if yes how?
What do you mean with "statistics" ?
Anyway the planner use statistics information, collected by
postgres statistics collector ( you should turn on it:
stats_start_collector = true
stats_reset_on_server_start = true
stats_command_string = true
stats_row_level = true
stats_block_level = true
).
How:
suppose to do a select like this:
select * from table_foo where field = X;
if the 100 % of rows have field = X is better do
a sequenzial scan without jump around use the index,
instead if only 0.1 % of the rows have the field = X is better
do an index scan ( specially if the table is really huge ).
In reality the data partitioning is not 100% or 0.1 % and the
planner some time can take wrong decision so you should
increase or decrease the cost of index scan or full scan
playing with:
cpu_tuple_cost
cpu_index_tuple_cost
cpu_operator_cost
I'm sorry to say however that since version 7.X
I'm not anymore able to drive correctly the planner,
is like the planner consider these values less then before.
I hope I was clear enough.
Regards
Gaetano Mendola