Postgres and Indexes on Foreign Keys and Primary Keys

前端 未结 7 1718
青春惊慌失措
青春惊慌失措 2020-12-02 03:34

Does Postgres automatically put indexes on Foreign Keys and Primary Keys? How can I tell? Is there a command that will return all indexes on a table?

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 04:28

    Yes - for primary keys, no - for foreign keys (more in the docs).

    \d 
    

    in "psql" shows a description of a table including all its indexes.

提交回复
热议问题