【发布时间】:2018-08-27 12:49:33
【问题描述】:
我的 postgres 数据库中有以下数据结构 - 一个名为 customer 的 jsonb 列
{
"RequestId": "00000000-0000-0000-0000-000000000000",
"Customer": {
"Status": "A",
"AccountId": 14603582,
"ProfileId": 172,
"ReferralTypeId": 15
}
"Contact": {
"Telephone": "",
"Email": ""
}
}
我想在ProfileId 字段上创建一个索引,它是一个整数。
我一直找不到如何在嵌套字段上创建索引的示例。
我正在执行的查询(大约需要 300 秒)是:
select id, customer from where customer @> '{"Customer":{"ProfileId": 172}}'
【问题讨论】:
标签: postgresql indexing jsonb