On Mon, Sep 21, 2015 at 5:21 PM, Paulo Maciel <paulosouzamac...@gmail.com> wrote: > +1 max_length optional >
I'm slightly worried from a DB point of view. Whilst blessed PostgreSQL supports variable length fields seemingly without issues, other DB engines (MySQL, for instance), have significant performance issues using a TEXT field versus a VARCHAR field - particularly on indexed fields, it must do a row read to retrieve data, rather than use an indexed value. Remember that VARCHAR columns can be fully indexed, whilst TEXT columns can only have the first N (specified by user) characters indexed, and reading the data will always require a row read, even if the text is shorter than the indexed size. In the ticket, it states that """ If I read the oracle docs correctly, specifying a length is mandatory for VARCHAR2, and the maximum is 4000 bytes. For MySQL, it's 65K bytes, for PostgreSQL and SQLite it's very large. """ For MySQL, it is 64k (65,535 bytes is *not* 65k!), and that is not the whole story - 64k is the maximum record size - all your columns must fit within that limit, not just one column in the record. http://dev.mysql.com/doc/refman/5.7/en/column-count-limit.html I'm slightly concerned as a MySQL/MariaDB user that this will lead to "reusable" apps that are not performant on MySQL. Given that we (generally) let Django define the database tables based upon models, it seems much more important that the definition is correct and high performing in all supported backends than to avoid choosing what database columns you require in the tables - after all, that is what the TextField is for, to allow the programmer to specify "this is an arbitrary length text field". I'm all for DB engines that support arbitrary length varchar fields to use that when you specify a TextField. I'm very not keen on having MySQL represent the majority of char fields as TEXT because no-one could be bothered to specify the appropriate length. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFHbX1KnWTfw6Hk18Buu3hZOiHVB2RW4JNk_PFdaO_QoLK6CmA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.