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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:39:59+00:00 2026-05-30T04:39:59+00:00

I am importing records from XML files, and it is chewing up memory. I’ve

  • 0

I am importing records from XML files, and it is chewing up memory. I’ve gone through the XML ElementTree that is created and deleted all of the elements and subelements to clear memory, but it still just piles up.

I finally found a solution, and wanted to have this in SO for others who may have the same problem in the future. I was scouring the web for answers, when I stumbled upon this: Django MemoryError – How to work with large databases. My MemoryError is not because of the size of my Queryset, because those aren’t that big, but I figured I’d give it a try anyway. I changed all of my objects.all() to objects.all().iterator() for any loops over objects. That didn’t do much, as I was only looping over about three different sets of objects, none of them huge sets. I reluctantly turned DEBUG=True to DEBUG=False in settings.py and it cut down the memory usage to almost nothing! From the Django Docs:

“It is also important to remember that when running with DEBUG turned on, Django will remember every SQL query it executes. This is useful when you’re debugging, but it’ll rapidly consume memory on a production server.“

This is not a production server, it is my development server. So, since all of the queries executed are stored, where are they and how can I get them? If they are so helpful for debugging, why aren’t they more readily available?

  • 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-30T04:40:00+00:00Added an answer on May 30, 2026 at 4:40 am

    Here’s how to display the queries:

    from django.db import connection
    print connection.queries
    

    For more info see this faq entry.

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

Sidebar

Related Questions

I'm importing ~18,000 records of various entities that are related to each other from
I'm importing some data from a CSV file, and numbers that are larger than
I have some txt files that contain tables with a mix of different records
I'm using sqlce 3.5 in Datalogic memor. Importing 40,000 records to a table from
I am importing data into a sql table from a csv using an xml
I have a simple rake task importing records from a CSV file and saving
So, I'm importing data from one database into another. There are about 5,000 records
When importing numbers from a csv file, I need to convert them to floats
After importing content from a legacy website using the Feeds module, I'm left with
I am importing the CreateICeeFileGen() function from the unmanaged DLL mscorpe.dll in a C#

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.