Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Select from View vs Direct Select from Tables
I have a view called V_PERSON_ADDRESS defined as:
SELECT FIRSTNAME, LASTNAME, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP
FROM PERSON_ADDRESS PA, PERSON P, ADDRESS A
WHERE P.PERSON_ID = PA.PERSON_ID AND A.ADDRESS_ID = PA.ADDRESS_ID;
PERSON is a table of Person data including names.
ADDRESS is a table of addresses.
PERSON_ADDRESS is the intersection between PERSON and ADDRESS (there's a
many-to-many relationship between them).
Now I want to return all persons in a specific state and city. So I do a Select like this:
SELECT * FROM V_PERSON_ADDRESS
WHERE STATE = my_state AND CITY = my_city;
Whar would be the performance difference between the above and directly querying with
SELECT FIRSTNAME, LASTNAME, ADDRESS_1, ADDRESS_2, CITY, STATE, ZIP FROM PERSON_ADDRESS PA, PERSON P, ADDRESS A WHERE P.PERSON_ID = PA.PERSON_ID AND A.ADDRESS_ID = PA.ADDRESS_ID AND A.STATE = my_state AND A.CITY = my_city;
Note that the View's definition and the direct query above are identical except for the last line.
Thanks,
Lito
Lito Dizon
adizon_at_us.net
Received on Sun Dec 15 1996 - 00:00:00 CST
![]() |
![]() |