Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9017183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:12:05+00:00 2026-06-16T04:12:05+00:00

I have a few questions related with database performance. I have the following Django

  • 0

I have a few questions related with database performance. I have the following Django model and its corresponding admin class in my app. The database is MySQL and it is hosted at Amazon RDS.

  1. It took more than 20 minutes to add around 45000 records in the Notifications table, via a for loop. Is this time slow or normal?
  2. The django admin interface for this table is too slow. It takes around 30 seconds to load under no dB load. And it usually takes more than 2 minutes to load when the database is performing any job. This table usually adds one million records every week or two. Is there a way to improve the performance of the database and/or system, or is this current load time normal?

MODEL

class Notification(models.Model):
    id = models.AutoField(primary_key=True)
    token = models.ForeignKey(Token, blank=False, null=False)
    alert = models.ForeignKey(Alert, blank=False, null=False)
    created_at = models.DateTimeField(auto_now=True)
    is_sent = models.BooleanField(default=False)
    is_processed = models.BooleanField(default=False)
    error_sending = models.BooleanField(default=False)
    # ...
    def __unicode__(self):
        return u'%s' % (self.alert )

ADMIN

class AppNotification(admin.ModelAdmin):
    fields = ['token','alert','is_sent','is_processed','error_sending']

    #
    list_display = ('token','alert','created_at','is_sent','is_processed','error_sending')

    #
    search_fields = ('app__app_name','token__token')

    #
    list_select_related = True

    #
    list_per_page = 25

admin.site.register(Notification,AppNotification)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:12:06+00:00Added an answer on June 16, 2026 at 4:12 am

    It took more than 20 minutes to add around 45000 records in the
    Notifications table, via a for loop. Is this time slow or normal?

    It’s not unusual in this setup. Django ORM is not fast and is not a good way to add thousands of entries if speed is important. Speed of RDS depends on the instance type, but generally lower-end ones aren’t fast either.

    Alternative is going low-level SQL or using bulk_create, however you have to keep in mind that neither of these methods will call objects .save() nor will it send pre_save and post_save signals. Which in case of these containing lot of business logic, that can be a problem.

    The django admin interface for this table is too slow. It takes around
    30 seconds to load under no dB load. And it usually takes more than 2
    minutes to load when the database is performing any job. This table
    usually adds one million records every week or two. Is there a way to
    improve the performance of the database and/or system, or is this
    current load time normal?

    You’ve got list_select_related = True in your model admin, which seems the only thing that can make it slow. It does join with Tokens and Alerts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to document-oriented database concepts and have a few high-level questions related to orders
I have few similar models in Django: class Material(models.Model): title = models.CharField(max_length=255) class Meta:
I have a few questions related to Windows processes in kernel and usermode. If
I have few questions related to web technologies. From my reading ant looking at
I have few questions related to events. Can anyone explain the exact need of
I have a few design-related questions: should service layer interfaces reside in a domain
I have asked a few questions related to this, but from different angles. I
I have found quite a few questions related to this but I haven't found
I have a few related questions. I am new to Rails 3 after taking
I have a few questions related: 1) Is possible to make my program change

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.