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 1033869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:17:56+00:00 2026-05-16T14:17:56+00:00

I have the following model: model rank(Models.model): username = models.CharField(max_length=200, default=0) points = models.IntegerField(default=0)

  • 0

I have the following model:

model rank(Models.model):
    username = models.CharField(max_length=200, default=0)
    points = models.IntegerField(default=0)
    rank = models.IntegerFiel(default=0)

what i want is, based on ‘points’ recalc this model, setting the result in ‘rank’ field.


i=0
user_list = db.Rank.objects.get.all().order_by('-points')

for user in user_list:
   user.rank = i
   user.save()
   i += 1

this works fine, but whit 1800 users i spend 130 MB of MEMORY !!!! Webfaction want kills me 🙂

how can i do this, without spent a lot of memory ?

  • 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-05-16T14:17:56+00:00Added an answer on May 16, 2026 at 2:17 pm

    The immediate cause of the memory leak is probably that you have DEBUG set to True. With debug on, Django keeps all the queries it runs in memory. Try it with DEBUG off and you should see usage go down considerably.

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

Sidebar

Related Questions

I have the following model: class test_data_urls(models.Model): url = models.CharField(max_length=200, db_index=True) I want to
I have the following model: class User: name = models.CharField( max_length = 200 )
I have the following model.py : class FinancialProduct(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=20)
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage
I have the following model: class mark(models.Model): title=models.CharField(max_length=35) url=models.URLField(max_length=200) user=models.ManyToManyField(User,blank=True) and then I use
I have the following model and instance: class Bashable(models.Model): name = models.CharField(max_length=100) >>> foo
I have two models class Status(models.Model) name = models.CharField(max_length=25) rank = models.PositiveSmallIntegerField() class MyModel(models.Model)
I have following model. class Comment(models.Model): type = models.CharField(max_length=21, choices=OBJECT_TYPE_CHOICES) program = models.ForeignKey(Program, db_column='object_id',
I have the following Model: class Group(models.Model): member = models.ManyToManyField(Player, through='GroupMember') name = models.CharField(max_length=20,
I have the following model class Command(models.Model): server = models.ForeignKey(Server) user_login = models.CharField(max_length=100) user_run

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.