Scenario

Site building:

  • Taxonomy: Vocabulary 'Countries' (around 300 terms, one for each country).
  • Content type Office: with a taxonomy reference field to Countries, so you can tag an office with a country.
  • View: showing Offices with an exposed filter on Countries taxonomy.

Front:

  • In the view's page, you filter by 100 countries to get the Offices in that countries.

Result:

SQLSTATE[HY000]: General error: 1116 Too many tables; MySQL can only use 61 tables in a join. Because internally Drupal builds a MySQL query with a LEFT JOIN for each taxonomy filter searched for (like LEFT JOIN {taxonomy_index} taxonomy_index_value_15 ON node_field_data.nid = taxonomy_index_value_15.nid AND taxonomy_index_value_15.tid = :views_join_condition_16).

Workarounds tried:

  •  I have tried to alter the query via hook_views_query_alter() to optimize it but I've had no success.

General thought:

  • I've been working as a Drupal back-end developer for the last 3 years and I've never faced this issue. I think that I'm missing something because this kind of a general issue that I don't understand why Drupal doesn't know how to handle it and throws an uncatched exception.

Comments

droprocker’s picture

I have the same issue with the webform view integration module, see the original issue #3070263: Mysql error after updating to actual version. And issue #3114888: How to access fields in views without webform views integration module? on the webform module issue queue.

Do you have any further information about this problem?