Re: Slow query on partitioned table.
От | Justin Pryzby |
---|---|
Тема | Re: Slow query on partitioned table. |
Дата | |
Msg-id | 20180327210032.GW28454@telsasoft.com обсуждение исходный текст |
Ответ на | Slow query on partitioned table. (Glenn Pierce <glennpierce@gmail.com>) |
Список | pgsql-performance |
Re-added -performance. On Tue, Mar 27, 2018 at 05:13:25PM +0100, Glenn Pierce wrote: > Damn as I was playing with the indexes I must have deleted the constraints :( > Question if I have a constraint like > > ALTER TABLE sensor_values_2007q1 > ADD CONSTRAINT sensor_values_2007q1_sensor_id_timestamp_constraint > UNIQUE (sensor_id, ts); > > will that be used like an index or do I need to add a separate index ? Yes: https://www.postgresql.org/docs/current/static/ddl-constraints.html |Adding a unique constraint will automatically create a unique B-tree index on the column or group of columns listed in the constraint https://www.postgresql.org/docs/current/static/indexes-unique.html |PostgreSQL automatically creates a unique index when a unique constraint or |primary key is defined for a table. The index ... is the mechanism that |enforces the constraint. Justin
В списке pgsql-performance по дате отправления: