|Knowledge Article Number||000213955|
|Description||Formula fields may appear to be simple in the SOQL Query but when SQL is generated , the same formula fields may become complicated .Many such formula fields in combination may cause this error.
The error, “QUERY_TOO_COMPLICATED: Query is either selecting too many fields or the filter conditions are too complicated.” occurs because your SOQL query exceeds 20k characters or because your query contains too many formula fields. We’ll go over what your options are for resolving the error.
|Resolution||Formula fields can become complicated at run time if there is a heavy calculation or if there are many formulas running at the same time.
Resolution would be to simplify the query by removing the formula fields from the Query and fetch non-formula fields only. Trial and error will help identify the offending formula fields.