Optimize query for information_schema.constraint_column_usage
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 18 Feb 2017 00:32:15 +0000 (19:32 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 18 Feb 2017 00:32:15 +0000 (19:32 -0500)
commite3a58c8835a2cd428b8534dd8df30a7cb96c976b
tree94ca7efc1a9bd155b501f197ea810463498573db
parent68f3dbc5525a7e78290f7dee8a74f66d5fa738d6
Optimize query for information_schema.constraint_column_usage

The way the old query was written prevented some join optimizations
because the join conditions were hidden inside a CASE expression.  With
a large number of constraints, the query became unreasonably slow.  The
new query performs much better.

From: Alexey Bashtanov <bashtanov@imap.cc>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
src/backend/catalog/information_schema.sql