On Sun, Dec 4, 2011 at 2:53 AM, Karen Tracey <kmtra...@gmail.com> wrote: > On Sat, Dec 3, 2011 at 9:37 PM, Nathan McCorkle <nmz...@gmail.com> wrote: >> >> when you say 'as long as you don't use the ORM for inserts', > > > You do not want to be building and saving objects individually with the ORM. > You want to be using some form of bulk insert. Django 1.4 will add bulk > create capability (see > https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-create). > Prior to 1.4 you can use the development trunk level code, or you can find > other libraries that provide bulk insert (see for example > http://ole-laursen.blogspot.com/2010/11/bulk-inserting-django-objects.html). > http://www.caktusgroup.com/blog/2011/09/20/bulk-inserts-django/ mentions the > kinds of speedups you can expect with using a bulk insert technique vs. > creating objects individually with the ORM. > > Karen
OTOH, if (like the OP) you have a few small (<1k) CSV files to import, then going through the ORM is easy, simple and quick to code. The fact that you can get it to run 1 minute quicker by not using the ORM is not relevant, unless importing CSV files is the main task of your server, and it will be doing it 24x7. Premature optimization is the root of all evil. Cheers Tom -- 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.