If the association nesting is too deep, slow SQL statements may be generated. You need to optimize the association nesting at the service layer.
For example, in MySQL, JOIN is equivalent to CROSS JOIN and INNER JOIN. However, in the SQL standards, JOIN is equivalent to INNER JOIN only and must be used together with the ON condition.
Negative examples: The following query statements return a Cartesian product:
SELECT * FROM TABLE1 A , TABLE2 B;
SELECT * FROM TABLE1 A JOIN TABLE2 B ON 1=1;
The comparison efficiency of the numeric type is much higher than that of the string type.
The comparison efficiency of integers is much higher than that of numeric and floating-point types.