On Mon, Jun 18, 2018 at 5:57 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm not sure about the "enforce constraint only" argument --- that sounds like a made-up use-case to me. It's pretty hard to imagine a case where a unique index applies to a query and yet you don't want to use it.
I've not seen it with unique constraints, but have with EXCLUDE constraints. GiST index costing is not very robust, and the planner can easily decide that a read query should use the EXCLUDE-supporting GiST index in cases where it is not optimal.