Re: 3 basic oracle questions
Date: Tue, 23 Apr 2002 15:50:05 +0100
Message-ID: <3cc5baa2_1_at_nova.entelchile.net>
For your first question .... yes....
If you have indexs in your table, queries works better if you use the same
order of creation columns (b,c). That's ocurrs in other databases too.
"David" <dfairman16_at_hotmail.com> escribió en el mensaje
news:b4cefdce.0204190306.257e318c_at_posting.google.com...
> Hello, I have an imaginary table tblTest, that will be created in
> Oracle and defined as below.
>
> CREATE TABLE tblTest(aNUMBER, b NUMBER, c NUMBER, PRIMARY KEY (a),
> UNIQUE (b,c));
>
> For the purposes of my query, imagine that there are 50 million
> records in the table, and a value of 'b' is 0 in 10 of the records,
> and the value of 'c' is 10 in 9 million of the records.
>
> My questions are:
> 1. Is one of these queries more efficient/quicker than the other?
> a) SELECT * FROM tblTest WHERE b=0 AND c=10
> b) SELECT * FROM tblTest WHERE c=10 AND b=0
>
> 2. Would the query efficiency be different in each case if, during
> table creation, I had used the query below instead?
>
> CREATE TABLE tblTest(aNUMBER, b NUMBER, c NUMBER, PRIMARY KEY (a),
> UNIQUE (c,b));
>
> 3. UNIQUE is essentially the equivalent to ALTERNATE KEY used by many
> other DBMS vendors isn't it?
>
> Thank you
> David
Received on Tue Apr 23 2002 - 16:50:05 CEST