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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:00:37+00:00 2026-05-16T21:00:37+00:00

I am exploring Django with MySQL & have a few things that I wanted

  • 0

I am exploring Django with MySQL & have a few things that I wanted to discuss –

  1. How can I add an index (on some field)? Can I do it through the Django Model Layer?
  2. If I want to migrate some old data into these new DB tables/models, will I have to write some script myself or does Django provide schema to schema mapping tools?
  3. If I need to change the schema for the existing Django Models, then what’s the easiest way to do this? I know this depends on my schema but is it as simple as create a new column & run python manage.py syncdb ?
  4. Lastly how do I profile MySQL db of all the queries I run from Django Models? I am looking for something like DEBUG=True and TEMPLATE_DEBUG=True kind of solution, where I’ll get the query performance (runtime etc.) on the browser.

Thanks in advance…

  • 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-16T21:00:38+00:00Added an answer on May 16, 2026 at 9:00 pm

    How can I add an index (on some field)? Can I do it through the Django Model Layer?

    You can. Take a look at the Field.db_index option.

    If I want to migrate some old data into these new DB tables/models, will I have to write some script myself or does Django provide schema to schema mapping tools?

    Django does not have a built in tool to do data migration. For migrating existing data you will have to write a custom script. This may be possible using an external migration tool (such as South, see below) but I haven’t tried it.

    Lastly If I need to change the schema for the existing Django Models, then what’s the easiest way to do this? I know this depends on my schema but is it as simple as create a new column & run python manage.py syncdb ?

    Use a migration tool. South is one of the popular and effective ones out there. There are others too. Using a tool will make your life much more easier for many reasons. For e.g. syncdb will not add new columns, only new tables.

    How do I profile MySQL db of all the queries I run from Django Models? I am looking for something like DEBUG=True and TEMPLATE_DEBUG=True kind of solution, where I’ll get the query performance (runtime etc.) on the browser.

    One of the ways to accomplish this is to use this classic Django snippet. Using the snippet you can append statistics about the queries fired to render a page to the bottom of the page if DEBUG is set.

    Update

    Another way to display the debug information is to use the django-debug-toolbar. Thanks @diegueus9.

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

Sidebar

Related Questions

I'm currently exploring django forms and have a issue I hope someone can help
I'm exploring Rails for the first time and trying to add some fairly straightforward
I just started exploring Scala in my free time. I have to say that
I am exploring iOS4.3 SDK & wanted to implement a particular animation effect. But
I'm exploring some things on apple script to control Instruments tool Need help on
I am exploring ASP.NET MVC and I wanted to add jQuery to make the
I am exploring file/images uploads in Django. I have a model with Photo class
I have been exploring patterns in various MV* frameworks out there and today noticed
I have been exploring different answers about release management in Mercurial and almost found
I've been exploring ways that it might be possible to promote the business of

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.