Question: can we write soql in constructor?
Answer: 2 Answers. Most of the code I have seen in Apex has a SOQL in the constructor. Well having a SOQL in the constructor is not bad practice unless its very bad and heavy SOQL which increases the page load time. ... In that case the constructor SOQL is bit overkill.