Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

which is more efficent?

Status
Not open for further replies.

lowbk

Technical User
Nov 26, 2001
162
SG
I am running a sql query in a servlet and i need advice on whether nested sql is more efficent or nested tables.

the nested sql looks like
select app from admtable
where appc in (select appc from apptable
where fin in (select fin from partable
where data=input))

the nested table looks like
select app from admtable, apptable, partable
where data=input and fin=fin and appc=appc

(ignore the syntax error)

which is more efficient?
 
It is database problem isn't it?
It is not possible to give a specific result to your question.
But here the things that you must consider.

If your tables have huge data.Joining tables will sure require performanca on your system.
In that situation :
if your query returns few records as a result it will be easier for your database to fetch the records by using nested query.But if the result is long, then joining them is more logical.

If your tables don't have many rows than use join method.(the first one). Salih Sipahi
Software Engineer.
City of Istanbul Turkey
openyourmind77@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top