background preloader

PostgreSQL

Facebook Twitter

Contraintes CHECK sur tables externe avec PostGreSQL - < Le blog de SQLpro/> PostgreSQL. PostgreSQL. Postgresql: Indexes on Foreign Keys. This query identifies foreign keys that are potentially missing indexes (Postgresql does not create indexes on foreign keys automatically). /* Look for foreign key constraints that are missing indexes on the referencing table.

Postgresql: Indexes on Foreign Keys

Orders results by the size of the referencing table, largest first, on the assumption that, all else being equal, they are the most likely to benefit from the addition of indexes. This is only meant as a starting point, and isn't perfect. It's possible, for example, that it will report a missing index when in fact one is available. e.g., it won't realize that an index on (f1, f2) could be used with a fk on (f1).