【发布时间】:2017-12-11 17:56:55
【问题描述】:
我有两个经常使用的查询,因此我应该真正使用索引,在查看所有索引后,我仍然无法确定哪个更适合以下查询:
select distinct F.nif, F.nome
from fornecedor F, produto P
where F.nif = P.forn_primario
and P.categoria = 'Frutos'
select ean, count(nif)
from produto P, fornece_sec F
where P.ean = F.ean
group by P.ean
由于第一个查询是多列的,我认为它应该是 B 树,但在文档中他们没有提到来自不同表的列。
【问题讨论】:
-
如果您不知道要改进什么,也许它不需要任何改进?您的请求实际上需要相当长的时间来响应吗?
标签: sql postgresql indexing database-indexes