question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

loading notifications raise OperationalError MySQL join limit

See original GitHub issue

Hi,

during my development after couple dozens of notification suddenly I was getting this exception. Have you ever met with this problem?

Method: GET
Request URL: http://localhost:8000/backend/estates/tour/

Django Version: 1.9.6
Python Version: 2.7.11


Template error:
In template /home/truhlik/Dropbox/web/reality/templates/base_list.html, error at line 0
   1116   1 : {% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
   2 : 
   3 : {% load i18n permissions django_tables2 common_tags %}
   4 : 
   5 : {% block body %}
   6 :     {% render_table list_table %}
   7 : {% endblock %}

Traceback:

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  174.                     response = self.process_exception_by_middleware(e, request)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  172.                     response = response.render()

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/response.py" in render
  160.             self.content = self.rendered_content

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  137.         content = template.render(context, self._request)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  69.                 result = block.nodelist.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/notify/templatetags/notification_tags.py" in render
  150.                 return self.generate_html(notifications)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/notify/templatetags/notification_tags.py" in generate_html
  48.         for nf in notifications:

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  258.         self._fetch_all()

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/notify/models.py" in _fetch_all
  36.                 prefetch_relations(self)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/notify/utils.py" in prefetch_relations
  102.         models = prefetch_relations(model_class.objects.filter(pk__in=object_ids).select_related())

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/notify/utils.py" in prefetch_relations
  86.     for weak_model in weak_queryset:

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  258.         self._fetch_all()

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  1074.             self._result_cache = list(self.iterator())

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  52.         results = compiler.execute_sql()

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  848.             cursor.execute(sql, params)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  95.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py" in execute
  112.             return self.cursor.execute(query, args)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/MySQLdb/cursors.py" in execute
  205.             self.errorhandler(self, exc, value)

File "/home/truhlik/.virtualenvs/reality/local/lib/python2.7/site-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.     raise errorclass, errorvalue

Exception Type: OperationalError at /backend/estates/tour/
Exception Value: (1116, 'Too many tables; MySQL can only use 61 tables in a join')

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
truhlikcommented, Jun 29, 2016

Great thank you. Let me know if I can help you with anything.

0reactions
v1k45commented, Jul 29, 2016

I think a simple switch for turning off prefetchs will do. I’ll push a fix as soon as i get time.

PS: ignore the old comment, I didn’t read your comment completely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

2 Server Error Message Reference - MySQL :: Developer Zone
Possible causes: Permissions problem for source file; destination file already exists but is not writeable.
Read more >
MySQL JOIN with LIMIT 1 on joined table - Stack Overflow
This would get me all records in products , which is not what I want. I want 1 [the first] product per category...
Read more >
Error Code 1117 Too many columns; MySQL column-limit on ...
Granted, denormalized data can prevent having to do JOINs to retrieve many columns of data. However, if you have over 10 columns, you...
Read more >
Preventing MySQL Error 1040: Too Many Connections
What this means in practical terms is that a MySQL instance has reached its maximum allowable limit for client connections.
Read more >
"MySQL server has gone away" error - Solution(s)
The MySQL server has gone away error, which means that the MySQL server (mysqld) timed out and closed the connection. By default, MySQL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found