Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> What index is prefered?

What index is prefered?

From: Oleg Roshchin <oleg_at_ca-ib.com>
Date: Mon, 9 Aug 1999 11:25:09 +0400
Message-ID: <7olvoe$rdo$1@news.netway.at>


Hi all,
Could you please help me in increasing performance of my queries?

I have a table with near 15 fields: one of date type, one of number type (my value field)
and all others of integer type (Foreign Keys) . The size of this table is longer than 200,000 records. The most often queries I need are like:

  1. select * from MyTable where DateFIeld<=D1 and id1=.. and id2=... (and so on for every integer field)
  2. select max(DateField) where DateField<=D1 and id1=.. and id2=... (and so on for every integer field) group by is1, id2, ...
  3. select sum(ValueField) where DateField<=D1 and id3=.. and id5=... (NOT for every integer field but FOR SOME of them) group by is3, id5, ...

Performance is very important!!!!!!!!! But I have problems with it!!!


QUESTIONS:
1) What are the prefered indexes?
What is better: to make many single indexes (one single index per each field)
OR to make one compound index containing all fields OR both?
2) How to deal with DateField in case of using compound index?

   (because I use "<=", not "=" comparing).    Is it a good idea to put this field the first field in the index?    Or to make compound index without DateField    and to make another single index for DateField? 3) How should I use hints for these queries?

    Now I try to use /*+ INDEX (Mytable MyCompoundIndex) */     Is it anything better?

ORACLE 8.0.5. Thank you in advance.

Oleg
Moscow,
Russia Received on Mon Aug 09 1999 - 02:25:09 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US