Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: What's the performance difference: 1 SELECT vs 5 SELECTS
Benchmark it.
I would go with 1 select. In the 2nd case you are causing 4 extra hard
parses which is CPU intensive. (you should use bind variables and name your
columns.
Jim
"Eino Komsi" <komsiikomsaa_at_yahoo.com> wrote in message
news:10b3c267.0210242029.5d3ed40f_at_posting.google.com...
> hi,
>
> I have the following table:
>
> CREATE TABLE SOME_TABLE (
> ID NUMBER(10) PRIMARY KEY NOT NULL,
> BIG1 VARCHAR(2000),
> BIG2 VARCHAR(2000),
> BIG3 VARCHAR(2000),
> BIG4 VARCHAR(2000),
> BIG5 VARCHAR(2000)
> );
>
> Now, I perform:
> a) one SELECT like: SELECT * FROM SOME_TABLE WHERE ID = 1234;
> versus
> b) five SELECTs like: SELECT BIG1 FROM SOME_TABLE WHERE ID = 1234;
> SELECT BIG2 FROM SOME_TABLE WHERE ID = 1234;
> SELECT BIG3 FROM SOME_TABLE WHERE ID = 1234;
> SELECT BIG4 FROM SOME_TABLE WHERE ID = 1234;
> SELECT BIG5 FROM SOME_TABLE WHERE ID = 1234;
>
> questions I'd like to know:
> 1. What is the performance diffence between a and b?
> 2. What is the CPU usage on the server in a compared to b ?
>
> a and b have different transactions, one for both. I.e. all the five
> selects are in the same transaction. The table contains like 50000
> rows.
>
> regards, EK
Received on Thu Oct 24 2002 - 23:50:20 CDT