我在Linux 14.04上使用Postgres 9.5.4。我为我的表创建了这个索引
CREATE INDEX my_object_times_name_gin_trgm_idx
ON my_object_times USING gin (name gin_trgm_ops);
这样我就可以快速运行这样的查询...
SELECT
COUNT(*)
FROM
"my_object_times"
INNER JOIN "my_objects"
ON "my_objects"."id" = "my_object_times"."my_object_id"
LEFT JOIN user_my_object_time_matches
ON my_object_times.id = user_my_object_time_matches.my_object_time_id
WHERE
(my_objects.user_id is null
AND my_object_times.name ilike 'DAVE ANTHONY')
我的问题是我可以用不同的方式创建索引,以便查询快速运行但我没有使用尽可能多的磁盘空间吗?我的磁盘空间非常紧张。