Can anyone tell me why Django do this while using save()? :

1) do select
2) if found do update
3) else do insert

In both case (insert or update) it ends in 2 steps.

It could be so :

1) Do insert
2) If ok then stop (1 step)
3) else if error because of PK's dupkey then do update (2 step only in
this case)

Moreover the first select could be "heavy" if the specified fields
aren't those contained in any index of the table, meanwhile the insert
going on dupkey should be fast anyway because it should just check the
index file for the existing PK (or maybe "behind the scenes" the
select first calculate the "id" and query for this value...but this
calculation is more or less equivalent to what the database engine
does for checking the existing PK by insert)

Am I wrong? What am I missing? Surely something, please tell me what.

Thank you.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to