java - Splitting Subqueries into Seperate Queries is more efficient? -


i've subquery this. i've used multiple detached criteria form multiple subqueries.

select         this_.id y0_,         this_.a y1_,         this_.b y2_,         this_.c y3_,         this_.d y4_,         this_.e y5_              table_a this_              this_.id in (             select                 this_.a y0_                              table_b this_                              this_.b=?                 ) 

currently don't have large amount of data in database tables. takes less 0.01 seconds execute query. i've been informed make each subquery seperate query feed list of values each in statement. don't know what'll difference between informed strategy vs current subqueries (posted above). subquery returns list of id's in statement, list of ids feed in statement if used sepearate queries? how come both these strategies differ in performance.

i've been told current subquery become slow if there large data in tables. both strategies doing same function. why it'll result in slow performance subqueries?

just consider sample java method calling

public static void main(string[] args){     system.out.print( c( b( a() ) ) ); }  public string a(){     return "success"; } public string b(string string){     return string; } public string c(string string){     return string; } 

first a called, b called feed return of a, c called feed return of b. return of c displayed.

i assume same kind of functionality followed in mysql subqueries. right? why subqueries result in slow performance when comparing total time of seperate queries?

i believe asking whats difference b/w correlated sub query , sub query , performance aspect

subquery :- inner query executed once inner query executed first , output of inner query used outer query

correlated subquery:- outer query executed first , every row of outer query, inner query executed. inner query executed many times no.of rows in result of outer query.

using co-related sub-query performance decreases, since, performs nxm iterations


Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -