首页 > 为什么我在postgresql的json数据中查询,速度会比mysql慢很多?

为什么我在postgresql的json数据中查询,速度会比mysql慢很多?

查询语句:
SELECT "count"(DISTINCT(data->>'Id')) from table1 where (data->>'Flag')::int = '1';


试一下9.4以上的,用jsonb


EXPLAIN SELECT "count"(DISTINCT(data->>'Id')) from table1 where (data->>'Flag')::int = '1';

看一下呢,请养成 EXPLAIN 的良好习惯。

不过我猜测可以通过加索引的方式来提高查询速度。

【热门文章】
【热门文章】