Thanks for your reply.  The tables I'm dealing with are entirely static,
but some have many millions of records, which is why I want my indexes to
work as good as possible.  If I create my indexes manually AFTER populating
the tables, will queries made via the django db api on those tables use
those indexes properly?

I'm thinking the answer is yes, since the use of the indexes happens at the
mysql level, and django just has to issue the select statement.

On Wed, Nov 14, 2012 at 3:42 PM, Javier Guerra Giraldez
<jav...@guerrag.com>wrote:

> On Wed, Nov 14, 2012 at 3:14 PM, Chris Pagnutti
> <chris.pagnu...@gmail.com> wrote:
> > The new index_together feature is great, but I think it's best to create
> an
> > index on a table AFTER the table is filled, and assuming there won't be
> many
> > new inserts.
>
> AFAIK, this is an optimization advice applicable only for mostly-static
> tables.
>
> > But in django, syncdb creates the index at the same time the
> > table is created, and of course, the table is initially empty.  How does
> > django deal with this?
>
> nothing to deal with, this is normal behaviour in all SQL-based databases.
>
> > Does it know to drop the index before inserting new
> > records and re-create the index afterwards?
>
> hell, no!, that would be hideously inefficient!
>
> what could be workable is to do that only on really big batch inserts,
> only if the indexes don't carry a restriction (like UNIQUE indexes),
> and really part of an off-line operation, not in the normal HTTP
> request processing.
>
> --
> Javier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to