On 16 Oct 2008, at 12:44 pm, bruno desthuilliers wrote:
> Given your models definitions, a Contact has one *or more* > AddressBooks. Is this the right modeling for your app ? If so, which > AddressBook instance do you use for your csv ? They can have more than one. It's a shop (based on satchmo) so they can have delivery address, billing address, etc. I am using the one marked as billing address for this export. >> If the above model definition is really the right one for your app, > then my best bet would be to go for raw sql. Not only will it save you > the one-extra-query-per-row, but also avoid the ORM overhead. FWIW, > this will probably be better (performance-wise) than denormalizing > *and* keeping the ORM !-). OK, I'll give that a try then. > And while we're at it, if you go the raw SQL route, avoid the infamous > 'select * ' when you only need a couple fields - this often really > helps the RDBMS optimiser. using raw SQL, you should probably be able > to exactly (or quite close to) match your rows with your CSV lines. Noted. > And, last point, learn to make proper use of your DB index. Which > doesn't mean "index all and everything", quite on the contrary - if an > index is not selective enough (ie : if you get more than 20% of your > table for a given index), then it may actually make things slower than > a plain sequential scan (unless eventually this index is used for a > join... Well, this starts getting complicated and sslightly OT - you > may want to seek more help on the topic on a more appropriate > neswgroup anyway...) Also noted. Many thanks for your help Bruno. Thanks, David -- David Reynolds [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---