[support] CCK fields being created as separate tables in the db
Alex Tang
altitude at funkware.com
Fri Mar 21 16:36:32 UTC 2008
Another way that a field is placed into a separate table is if that
field ("hobbies" or "favourite music genres") have been added to more
than one table.
When you add or remove a field from a table, CCK will alter the DB
tables on the fly and move the data into and out of your tables. I was
at the boston drupalcon and worked with KarenS at the sprint, she talked
about how this works and that it's a bit ugly inside.
She also mentioned that although it may seem that having the field data
in separate tables may seem like a significant performance hit, after
doing some testing, it's not as bad as you'd think due to the way cck
does caching. I didn't fully understand at the time, but after poking
around the code a bit, i can see how that might be so.
...alex...
Gordon Heydon wrote:
> Hi,
>
> Yes this is correct, and there have been some people that will tell you
> to use multiple and shared fields as little as possible as it is a
> performance impact.
>
> I have recently discovered that this is not true. All fields not matter
> what the type all have basically the same performance impact.
>
> The basic rule with CCK is to keep the total numbers of fields per node
> as few as possible.
>
> I have fixed this in Drupal 5, and just need to clean up the patch
> before I submit it.
>
> Gordon.
>
> Neil: esl-lounge.com wrote:
>
>> OK, I found the answer in the second half of this article on the db
>> aspects of CCK:
>>
>> http://www.lullabot.com/articles/an_introduction_to_the_content_construction_kit
>>
>> the two fields (which were actually hobbies and favourite music genres
>> now I recall...) both accepted multiple values so it seems that is the
>> crucial factor in deciding whether a CCK field gets added to the db as a
>> separate table or part of a content type table: that - and whether the
>> field is shared between content types.
>>
>> Neil
>>
>> ----- Original Message -----
>> *From:* Neil: esl-lounge.com <mailto:neil at esl-lounge.com>
>> *To:* support at drupal.org <mailto:support at drupal.org>
>> *Sent:* Friday, March 21, 2008 10:16 AM
>> *Subject:* [support] CCK fields being created as separate tables in
>> the db
>>
>> I've been pulling my hair out about this for two hours. I have made
>> a nodeprofile content type and am using cck fields to build it.
>>
>> All the fields I created were added as columns to the
>> content_type_nodeprofile table....except the last two which were
>> added to my db as separate tables:
>>
>> content_field_hobbies
>> content_field_age
>>
>> these were the last two I added and, also, I had a few problems with
>> the "group" they sat in, so I ended up changing the name and
>> deleting and recreating the groups at least once...may this have
>> caused the issue?
>>
>> I've tried totally deleting the relevant fields and groups and
>> starting again, but they keep getting created as separate tables. Aagh!!
>>
>> Basically, what is it that makes CCK create a field as a separate
>> table instead of putting it as a column inside the content type table?
>>
>> Neil
>>
>> ------------------------------------------------------------------------
>>
>> --
>> [ Drupal support list | http://lists.drupal.org/ ]
>>
>> !DSPAM:1000,47e3814722643366512726!
>>
>>
More information about the support
mailing list