I am little confuse in the concept of Gas Estimation and price. When i add new user i get popup through metamask for the transaction amount and gas used which is totally fine.
I checked my code in the remix. When i see details the function which are purely reading data or returning the array length of user also use some Gas estimation like function name "totalInvestorInvestment" and "totalLoans". Where as "totalInvestedAmountInLoan" has gas estimate of Infinite its because I am using "For" loop.
1) So how this Gas estimation work as i read that reading data in blockchain is free, so if its free how that Gas usage is paid by the function "totalInvestorInvestment" and "totalLoans"?
2) And is there any limit for the usage of Gas in reading data which is free?
3) Is it good practice to use for loop? To avoid large data set i am also storing the indexes in array and using for loop on that array.