Re: [Django] #16427: truncate table method in ORM

2011-07-06 Thread Django
#16427: truncate table method in ORM
-+-
   Reporter: |  Owner:  nobody
  adamnelson | Status:  closed
   Type:  New|  Component:  Database layer
  feature|  (models, ORM)
  Milestone: |   Severity:  Normal
Version:  1.3|   Keywords:
 Resolution:  wontfix|  Has patch:  0
   Triage Stage:  Design |Needs tests:  0
  decision needed|  Easy pickings:  0
Needs documentation:  0  |
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-
Changes (by lukeplant):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 wontfixing, for the reasons aaugustin gave. If delete() is too slow use
 manual SQL truncate. https://docs.djangoproject.com/en/dev/topics/db/sql
 /#executing-custom-sql-directly . For specialised needs, this is good
 enough, and it's not hard to get the db table name for a model.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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



Re: [Django] #16427: truncate table method in ORM

2011-07-06 Thread Django
#16427: truncate table method in ORM
-+-
   Reporter: |  Owner:  nobody
  adamnelson | Status:  new
   Type:  New|  Component:  Database layer
  feature|  (models, ORM)
  Milestone: |   Severity:  Normal
Version:  1.3|   Keywords:
 Resolution: |  Has patch:  0
   Triage Stage:  Design |Needs tests:  0
  decision needed|  Easy pickings:  0
Needs documentation:  0  |
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-

Comment (by adamnelson):

 The solution to the sqlite issue is simply to do "DELETE table_name" for
 that backend when calling the truncate() method.

 
[http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0902/en/html/dbrfen9/0500.htm
 Sybase] claims that TRUNCATE is SQL-92 compliant as part of the Transact-
 SQL extension.

 The problem with the delete() method is that it's exceedingly slow.  On
 tables with more than 1M records, DELETE can take up to 10 minutes to run
 compared to seconds to truncate - with the same outcome.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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



Re: [Django] #16427: truncate table method in ORM

2011-07-06 Thread Django
#16427: truncate table method in ORM
-+-
   Reporter: |  Owner:  nobody
  adamnelson | Status:  new
   Type:  New|  Component:  Database layer
  feature|  (models, ORM)
  Milestone: |   Severity:  Normal
Version:  1.3|   Keywords:
 Resolution: |  Has patch:  0
   Triage Stage:  Design |Needs tests:  0
  decision needed|  Easy pickings:  0
Needs documentation:  0  |
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-
Changes (by aaugustin):

 * needs_docs:   => 0
 * stage:  Unreviewed => Design decision needed
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 As far as I can tell, `TRUNCATE` is not part of SQL-92, and it isn't
 implemented by sqlite, so it isn't a good candidate for ORM support.

 What's wrong with `MyModel.objects.delete()`? At least sqlite will
 optimize this by performing a truncate. I don't know very well the
 internal of other database engines, but they may optimize it too.

 Finally, you can use raw SQL.

 I'm leaning towards "wontfix", but let's wait for a core developer's
 opinion,

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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



[Django] #16427: truncate table method in ORM

2011-07-06 Thread Django
#16427: truncate table method in ORM
-+--
 Reporter:  adamnelson   |  Owner:  nobody
 Type:  New feature  | Status:  new
Milestone:   |  Component:  Database layer (models, ORM)
  Version:  1.3  |   Severity:  Normal
 Keywords:   |   Triage Stage:  Unreviewed
Has patch:  0|  Easy pickings:  0
UI/UX:  0|
-+--
 In the interest of having a more complete ORM, there should be a truncate
 table command available.  This could be used in specialized cases where
 the user needs to delete very large tables (i.e. migrations on volatile
 tables, tables with data that gets purged regularly, etc...)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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