我正在考虑在(1)中创建散列索引,因为它使用(2)上的等式和位图,因为状态只能被“接受”或“不被接受”。我还能使用什么?也是我的问题是,我只能尽量在MySQL的Oracle B树索引..我应该创建哪些类型的索引来优化这些mysql查询?
(1)select R.user_id from rent as R
inner join supervise S on
R.adress = S.adress
and R.space_id = S.space_id
group by R.user_id
having count(distinct S.supervisor_id) = 1
(2) select distinct P.adress, P.code from space as P where (P.adress, P.code) not in (
select P.adress, P.code from space as P
natural join rent as R
natural join state as E where E.state = ‘accepted’)
为什么你的代码中有['零宽度空间'(U + 200B)](http://www.fileformat.info/info/unicode/char/200b/index.htm)字符? ---为什么你的文字使用时髦的撇号(''和''',而不是''')? – Andreas