Re: [Snowy] Issues with MySQL



On Sun, 2009-05-31 at 20:54 -0400, Og Maciel wrote:
> On Sun, May 31, 2009 at 8:39 PM, Sandy Armstrong
> <sanfordarmstrong gmail com> wrote:
> > That being said, I don't know what error Og was experiencing that required the change he
> > made.  We should discuss this before adding in any hacks.
> 
> The issue is with django actually, using a blog/text field as part of
> a unique key, as outlined in the link I posted before. Once I changed
> that field to CharField, it was smooth sailing.

As far as I can gather from the Django bug report you linked us, Og, the
problem is setting unique=True on TextFields.  And when you think about
how TEXT is implemented in MySQL, it makes total sense.

Using unique=True, MySQL has to build an index for that column so that
it can easily verify that there are no rows with the same column value.
TEXT has an unbounded length, so MySQL refuses to build an index without
a column length as it would cause a massive performance hit and negate
the efficiency of an index.

In summation, we can't set unique=True on a TextField, so we have two
choices:

  1) Allow notes with the same title
   
  or
  
  2) Bound the length of the Title and use a CharField.

To me, #2 seems like a better choice.

Hopefully this sheds a little more light into the situation for you,
Sandy.

Best,

-Brad



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]