Selecting data effectively sql
Posted
by learner135
on Stack Overflow
See other posts from Stack Overflow
or by learner135
Published on 2010-05-27T06:13:53Z
Indexed on
2010/05/27
6:21 UTC
Read the original article
Hit count: 180
Hi,
I have a very large table with over 1000 records and 200 columns. When I try to retreive records matching some criteria in the WHERE
clause using SELECT
statement it takes a lot of time. But most of the time I just want to select a single record that matches the criteria in the WHERE
clause rather than all the records. I guess there should be a way to select just a single record and exit which would minimize the retrieval time. I tried ROWNUM=1
in the WHERE
clause but it didn't really work cause I guess the engine still checks all the records even after finding the first record matching the WHERE
criteria. Is there a way to optimize in case if I want to select just a few records?
Thanks in advance.
Edit:
I am using oracle 10g.
© Stack Overflow or respective owner