On 03/04/2025 6:29 pm, Aleksander Alekseev wrote:
I have mixed feelings about addressing this. Although this behavior is somewhat counterintuitive, if the user has a read-only lookup table he/she can always execute VACUUM manually. In order to relieve him of this unbearable burden we are going to need to introduce some overhead that will affect all the users (not to mention people maintaining the code). This would be convenient for sure but I'm not entirely sure if it's worth it.
Overhead seems to be minimal (update of one statistic field in case of heap fetch in index-only scan) and information about visibility checks performed by IOS seems to be useful in any case, even if it is not used by autovacuum.
So I am not sure how frequent this scenario is (when index-only scan has to perform extra heap checks or is just not used because of VM examination), but if it can be prevented without much efforts or overhead, then why not to implement it?