on 04-05-2010 11:42 AM
Hi
While i am trying to select data from one Table where field = ( array of values from sender ) performence wise which is the best way among the below 2 ways
1) executing multiple statements (means Occurence 1..unbound) in the receiver message type with single occurence key field for each statement.
eg: select field1 from table where filed2 = 1 ( one among the array of input values used as condition to select)
select field1 from table where filed2 = 2
select field1 from table where filed3 = 3
2) executing single statement with mutiple occurence key field mapping all the array values to that key field
eg: select field1 from table where (filed2 = 1 or field2 = 2 or field3 = 3);
Thanks
krish
Run the same queries in the SQL Profiler on your Database and find out the best performing query. Thats the best way to go.
VJ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It depends on how your RDBMS processes SQL statements, but I'd go for a single SQL query to retrieve all necessary data (avoids overhead at JDBC - if any - and DB caching/parsing mechanisms) ...
Of course, if you have hundreds or thousands of potential values in your selection clause, a split strategy might be necessary
Rgds
Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.