+ Start a Discussion
zubair shareef mohammadzubair shareef mohammad 

Using soql

Hi, this is zuber

1) Using Soql quiers can we fetch 1 lakh records ?
2) by using Soql, I am fecthing 1000 records if it takes 1 min to fetch then how can we reduce the fectching time ? Is there is any way ?
3) How to reduce the number of soqls in a transaction ?

Please give me clear description on this topics 
Thank you
Harish RamachandruniHarish Ramachandruni
Hi,


show me your query it wont take that mouch of time .

you can follow this document . 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm

https://trailhead.salesforce.com/en/apex_database/apex_database_soql .



regards,
harish.R
AshlekhAshlekh
Hi,

1) Using Soql quiers can we fetch 1 lakh records ?
- In Apex there is limit of records you can fetch in one transaction which is 50K.

2) by using Soql, I am fecthing 1000 records if it takes 1 min to fetch then how can we reduce the fectching time ? Is there is any way ?
- To reduce the time of fetching you need to user filters with Indexed field like Id, Name.

3) How to reduce the number of soqls in a transaction ?
-Strange,about this question. A developer should know the use cases for which the block code has written and depend the use cases and follow the best practise to reduce the soqls.

@Harish has already provided the links of documentations.


-Thanks
Ashlekh Gera
Prashant Pandey07Prashant Pandey07
Can I know the situation where you need to process the 1 lakh record?
  • However you can process over 1 lakh record using Batch apex which will break the record into small 2 chunk and process it.
  • You can using SOQL query optimizer to optimize your query like - (Id, like, AND ,OR , Name, OwnerId, CreatedDate, SystemModstamp, RecordType (indexed for all standard objects that feature it) ,Master-detail fields ,Lookup fields, Other Indexed Fields Unique fields External ID fields) etc
  • Never  run any query if the set being used in the where clause is empty
  • Never run a query if the code is dependent on another piece of functionaltiy occurring