‎2009 Feb 16 10:59 AM
Hello all,
I have following scenario:
1) I have one select query which is fetching 5,000 records from data base in single select.
2)Two select query from the same table fetching 1,000 records each time.
I want to know that which option will take more time that is 1 will take more time or 2.
Thanks and regards
Sachin
‎2009 Feb 16 11:22 AM
always better to use select once. if we use it multiple times it will take more time.
‎2009 Feb 16 11:22 AM
always better to use select once. if we use it multiple times it will take more time.
‎2009 Feb 16 11:36 AM
1) interview question, and if not then
2) why ask when you can simply try yourself?
‎2009 Feb 16 11:48 AM
Modification:
1) one select query which is fetching 5,000 records from data base in single select.
2) select query from the same table with a ranges table fetching 5,000 records each time.
Which one is better??? (note the answer is different from the original question!)
Siegfried
‎2009 Feb 18 9:09 AM
Hi,
check the coding with se30.
Analysis the time taken in both type of select statements.
Regards,
Anagha Deshmukh
‎2009 Feb 19 4:28 AM
The first option is better in which there is a single database hit.
In the second option you are hitting the database twice for the same table.
So the second option will take more time than the first one.
‎2009 Feb 23 4:12 PM
Hi Sachin,
The second selection query will take more time beacuse it has to hit the data base 2 times and also increases traffic on database server hence it takes more time .
and second selection query may take 4 to 5 times of first selection query.
Regards
Babumiya Mohammad.
‎2009 Feb 24 5:13 AM
Hi,
Actually, that depends upon the DDIC table, for example if you are accessing from BSAK (FI Table) its a big table,
use key fields in where condition. If not able to get keyfields, then fire some other select query in order to get the key fields.
Logic gets changes as per the size of table, if it holds records in lac then its okey to fire one query, else use keyfields, to get records fast.
Hope this may clear some doubt.
Thanks,
Krishna