小编And*_*ndy的帖子

Postgres 不够聪明,无法结合 WHERE 和 ORDER BY 中的字段进行索引扫描?

我在 Postgres 9.6 中有下表:

                                       Table "public.TagNotifications"
    Column    |            Type             |                            Modifiers                            
--------------+-----------------------------+-----------------------------------------------------------------
 createdAt    | timestamp with time zone    | not null default now()
 updatedAt    | timestamp with time zone    | not null default now()
 id           | integer                     | not null default nextval('"TagNotifications_id_seq"'::regclass)
 tag          | character varying(255)      | not null
 triggerId    | integer                     | 
 userId       | integer                     | not null
 comparison   | "TagNotificationComparison" | 
 setpoint     | double precision            | 
 severity     | "TagNotificationSeverity"   | 
 acknowledged | boolean                     | not null default false …
Run Code Online (Sandbox Code Playgroud)

postgresql performance optimization order-by query-performance

4
推荐指数
1
解决办法
66
查看次数