Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data base access time

sachin_yadav3
Active Participant
0 Likes
906

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
856

always better to use select once. if we use it multiple times it will take more time.

7 REPLIES 7
Read only

Former Member
0 Likes
857

always better to use select once. if we use it multiple times it will take more time.

Read only

ThomasZloch
Active Contributor
0 Likes
856

1) interview question, and if not then

2) why ask when you can simply try yourself?

Read only

Former Member
0 Likes
856

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

Read only

Former Member
0 Likes
856

Hi,

check the coding with se30.

Analysis the time taken in both type of select statements.

Regards,

Anagha Deshmukh

Read only

Former Member
0 Likes
856
  • 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.

Read only

Former Member
0 Likes
856

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.

Read only

Former Member
0 Likes
856

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