PostgreSQL composite primary key
问题 In MySQL, when I create a composite primary key, say with columns X, Y, Z , then all three columns become indexes automatically. Does the same happen for Postgres? 回答1: If you create a composite primary key, on (x, y, z) , PostgreSQL implements this with the help of one UNIQUE multi-column btree index on (x, y, z) . In addition, all three columns are NOT NULL (implicitly), which is the main difference between a PRIMARY KEY and a UNIQUE INDEX . Besides obvious restrictions on your data, the