小编Zee*_*han的帖子

Postgres 使用 order by、index 和 limit 进行慢速查询

我正在尝试提高 postgres(9.6) 查询的性能。这是我的架构,表包含大约 6000 万行。

          Column          |            Type             | Modifiers
--------------------------+-----------------------------+-----------
 transaction_id           | text                        | not null
 network_merchant_name    | text                        |
 network_merchant_id      | text                        |
 network_merchant_mcc     | integer                     |
 network_merchant_country | text                        |
 issuer_country           | text                        |
 merchant_id              | text                        |
 remapped_merchant_id     | text                        |
 created_at               | timestamp without time zone |
 updated_at               | timestamp without time zone |
 remapped_at              | timestamp without time zone |
Indexes:
    "mapped_transactions_pkey" PRIMARY KEY, btree (transaction_id)
    "ix_mapped_transactions_remapped_at" btree (remapped_at NULLS FIRST)
Run Code Online (Sandbox Code Playgroud)

这是我试图执行的查询。

SELECT * …
Run Code Online (Sandbox Code Playgroud)

postgresql performance order-by limits postgresql-9.6 query-performance

7
推荐指数
1
解决办法
3985
查看次数