Peter Geoghegan wrote: > Now, that might not seem like that much of a difference, but if you > consider how duplicates are handled in the B-Tree code, and how unique > index enforcement works, I think it could be. It could lead to heavy > buffer lock contention, because we sometimes do a lot of work with an > exclusive buffer lock held.
Not to mention work done with a "buffer cleanup lock" held -- which is compounded by the fact that acquiring such a lock is prone to starvation if there are many scanners of that index. I've seen a case where a very hot table is scanned so heavily that vacuum is starved for days waiting to acquire cleanup on a single page (vacuum was only able to finish because the app using the table was restarted). I'm sure that a uniform distribution of keys, with a uniform distribution of values scanned, would give a completely different behavior than a highly skewed distribution where a single key receives a large fraction of the scans. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (firstname.lastname@example.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers