What is the reason of the values of cpu_index_tuple_cost and cpu_tuple_cost being different?
Shouldn’t it take the same amount of time, once the reader head is already reading that page?
I checked the documentation (https://www.postgresql.org/docs/current/runtime-config-query.html#GUC-CPU-TUPLE-COST) and I expected cpu_index_tuple_cost and cpu_tuple_cost to be same.
>Solution :
“Reader head” and “page” seem to suggest that disk I/O plays a role here, but the cost parameters for that are random_page_cost and seq_page_cost. cpu_index_tuple_cost and cpu_tuple_cost are about the CPU time spent processing a single index or table entry. Now index tuples are typically much smaller than table tuples, so estimating a lower cost is justified.
I dug into the history of that parameter, and it was introduced in commit b1577a7c78 in 2000 with a value of 0.001, a tenth of cpu_tuple_cost. Later, it was decided that the value was too small (see the discussion), and commit e4de635a2b from 2006 changed the default value to 0.005.