| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: index problem: leading subset of columns?
Richard thanks for your reply, it is what I need, but what about my 2nd
question?
"Question 2: Do we need a group(aggregate) function in the select clause of select statement? When does an index is used without an WHERE clause in a select statement?"
I think I did not ask my question clearly, rephrasing my question may help: For example we had defined an index on column product_id and issue the following query:
SELECT max(product_id)
FROM oe.inventories;
What happens will our index be used or not?
Regards...
Derya.
"Richard Foote" <richard.foote_at_bigpond.com> wrote in message
news:vbm9a.60859$jM5.156048_at_newsfeeds.bigpond.com...
> "Derya OKTAY" <deryaoktay_at_uekae.tubitak.gov.tr> wrote in message
> news:b432rd$660$1_at_list.ege.edu.tr...
> > Hello, I want to ask questions according to below quoted paragraph?
> > ------------
> > The OE.INVENTORIES table has the index INVENTORY_PK on the PRODUCT_ID
and
> > WAREHOUSE_ID columns.
> >
> > We can use this INVENTORY_PK index with the following query:
> > SELECT SUM(wuantity_on_hand)
> > FROM oe.inventories
> > WHERE warehouse_id=3
> > AND product_id=3191;
> >
> > also we can use this INVENTORY_PK index with the following query:
> >
> > SELECT SUM(wuantity_on_hand)
> > FROM oe.inventories
> > WHERE product_id=3;
> > ...
> >
> > We would not be able to use the INVENTORY_PK index if we ran the
following
> > query to see how many items are in warehouse ID 3, because WAREHOUSE_ID
is
> > not a leading subset of columns in the index:
> >
> > SELECT SUM(wuantity_on_hand)
> > FROM oe.inventories
> > WHERE warehouse_id=3;
> >
> > --------------
> > Question 1: Does leading column refers only one column if a composite
> index
> > is composed of more than two columns?
> >
>
>
>
>
>
>
![]() |
![]() |