Table A consists of (id, fieldA, fieldB, fieldC, fieldD)
Table B consists of (id, tableA-id, fieldE, fieldF, fieldG)
My queries looks like this:-
1. select * from tableB b, tableA a where a.fieldA=? and a.fieldB=? and a.fieldC=? and a.fieldD=? and (b.fieldF >= '09/01/10' and b.fieldF <= '09/30/10');
2. select * from tableB b, tableA a where a.fieldA=? and a.fieldB=? and a.fieldC=? and a.fieldD=? and b.fieldE=? and (b.fieldF >= '09/01/10' and b.fieldF <= '09/30/10');
Примечание: полеE является дополнительным параметром для [2]
Как определить мои индексы для размещения этих запросов
Хорошее начало было бы, я думаю, быть:
create index huge_index on tableA (fieldA, fieldB, fieldC, fieldD)
create index modest_index on tableB (fieldF, fieldE);
Возможно также B.tableA-id. Гуру может быть в состоянии предложить, может ли помочь какой-то индекс в B, включая как tableA-id, так и другие значения.