Opened 7 years ago

Last modified 2 years ago

#27864 closed Cleanup/optimization

(1116, 'Too many tables; MySQL can only use 61 tables in a join') — at Initial Version

Reported by: VINAY KUMAR SHARMA Owned by: nobody
Component: contrib.admin Version: 1.8
Severity: Normal Keywords: mysql
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Found this bug when searching with long string:

OperationalError at /posts/posts

(1116, 'Too many tables; MySQL can only use 61 tables in a join')

Request URL: http://cms.example.com/posts/posts/?q=Deliverable++TRC+Promo+%282+Options%29+Visual+Snapshot++%28Montage%29+How+do+you+know+your+reward+Strategy+is+working%3F+Masterclass%3A+Consumerization+of+Total+Rewards%3A+Superhero%27s+Toolkit+Alignment%2C+Management+and+Governance+of+%E2%80%98Executive+Pay%E2%80%99+and+Long+Term+Incentives+Award+Ceremony%3A+League+Awards+-Total+Rewards+2017+%22Masterclass%3AMotivating+your+Internal+Customers++Part+II%3A+A+Communication+Toolkit+by+Preeti+Gupta%2C+Aditya+Birla+Group

I've created an CMS system using Django Admin, where models Posts is in app Posts.

Model Posts has an M2M field authors, and this field I've included in search for admin.ModelAdmin:

e.g here:

# models.py
@python_2_unicode_compatible
class Posts(models.Model):
    id = models.AutoField(primary_key=True, db_column='article_id')
    #
    # ... other fields ...
    #
    # Related M2M/Foreign Key fields
    authors = models.ManyToManyField(Author, through='PostAuthors',
                                     through_fields=('post', 'author'))
    subcategories = models.ManyToManyField(SubCategory, through='PostSubcategory',
                                           through_fields=('post', 'subcategory'))

# admin.py
@admin.register(Posts)
class PostsAdmin(admin.ModelAdmin):
    actions = [delete_selected, republish_selected, add_to_top_stories]
    list_per_page = ADMIN_LIST_PER_PAGE
    list_filter = [PostTypeListFilter, 'datetime', 'is_active', 'is_deleted']
    search_fields = ['authors__name', 'title']

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top