Re: Hash Indexes
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Peter Geoghegan <pg@heroku.com>,
Andres Freund <andres@anarazel.de>,
Jesper Pedersen <jesper.pedersen@redhat.com>,
Amit Kapila <amit.kapila16@gmail.com>,
Mithun Cy <mithun.cy@enterprisedb.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2016-10-03T17:28:40Z
Lists: pgsql-hackers
Jeff Janes <jeff.janes@gmail.com> writes: > I've done a simple comparison using pgbench's default transaction, in which > all the primary keys have been dropped and replaced with indexes of either > hash or btree type, alternating over many rounds. > I run 'pgbench -c16 -j16 -T 900 -M prepared' on an 8 core machine with a > scale of 40. All the data fits in RAM, but not in shared_buffers (128MB). > I find a 4% improvement for hash indexes over btree indexes, 9324.744 > vs 9727.766. The difference is significant at p-value of 1.9e-9. Thanks for doing this work! > The four versions of hash indexes (HEAD, concurrent, wal, cache, applied > cumulatively) have no statistically significant difference in performance > from each other. Interesting. > I think I don't see improvement in hash performance with the concurrent and > cache patches because I don't have enough cores to get to the contention > that those patches are targeted at. Possibly. However, if the cache patch is not a prerequisite to the WAL fixes, IMO somebody would have to demonstrate that it has a measurable performance benefit before it would get in. It certainly doesn't look like it's simplifying the code, so I wouldn't take it otherwise. I think, though, that this is enough to put to bed the argument that we should toss the hash AM entirely. If it's already competitive with btree today, despite the lack of attention that it's gotten, there is reason to hope that it will be a significant win (for some use-cases, obviously) in future. We should now get back to reviewing these patches on their own merits. regards, tom lane
Commits
-
Remove _hash_wrtbuf() in favor of calling MarkBufferDirty().
- 25216c989384 10.0 landed
-
Fix race introduced by 6d46f4783efe457f74816a75173eb23ed8930020.
- 2f4193c3509a 10.0 cited
-
Improve hash index bucket split behavior.
- 6d46f4783efe 10.0 landed
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited