<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I always look at the use case when deciding if I should add to a core
table or go with a separate table all together. Basically I base it on
any queries that are going to run. In your situation, I would add to
the core table if you will be setting sort and query criteria to the
core columns and your new ones. If you aren't going to query on those
columns, or sort on them, then a second table is probably better and
just join it.<br>
<br>
So:<br>
<br>
SELECT n.*, c.* FROM node n INNER JOIN customer c ON c.nid=n.nid WHERE
n.status=1 AND n.promote=1 ORDER BY n.created DESC<br>
<br>
That would be fine since all the selection and sort stuff is done on
the node table, but:<br>
<br>
SELECT n.*, c.* FROM node n INNER JOIN customer c ON c.nid=n.nid WHERE
n.status=1 AND n.promote=1 AND c.customer="acme" ORDER BY n.created DESC<br>
<br>
That would be better adding the columns to a core table, since you are
going to get into some nastier queries that can easily go to tablesorts
and temporary tables.<br>
<br>
Just my $.02<br>
<pre class="moz-signature" cols="72">Jamie Holly
<a class="moz-txt-link-freetext" href="http://www.intoxination.net">http://www.intoxination.net</a>
<a class="moz-txt-link-freetext" href="http://www.hollyit.net">http://www.hollyit.net</a></pre>
<br>
On 7/12/2010 12:46 PM, nan wich wrote:
<blockquote cite="mid:350255.41879.qm@web180301.mail.gq1.yahoo.com"
type="cite">
<style type="text/css"><!-- DIV {margin:0px;} --></style>
<div style="font-family: arial,helvetica,sans-serif; font-size: 12pt;">
<div>Pierre, if the data was that important, I would add it to
another table and maybe even normalize it. This is stuff like the name
and company of the commenter - both about as important as the email
address that is already there. This is just not serious stuff in this
case.<br>
</div>
<p><font size="4" color="#ff007f"
face="bookman old style, new york, times, serif"><em><strong>Nancy E.
Wichmann, PMP</strong></em></font></p>
<p><font face="arial, helvetica, sans-serif">Injustice anywhere is a
threat to justice everywhere. -- Dr. Martin L. King, Jr.</font></p>
<div><br>
</div>
<div style="font-size: 12pt; font-family: arial,helvetica,sans-serif;"><br>
<div style="font-size: 10pt; font-family: arial,helvetica,sans-serif;"><font
size="2" face="Tahoma">
<hr size="1"><b><span style="font-weight: bold;">From:</span></b>
Pierre Rineau <a class="moz-txt-link-rfc2396E" href="mailto:pierre.rineau@makina-corpus.com"><pierre.rineau@makina-corpus.com></a><br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:development@drupal.org">development@drupal.org</a><br>
<b><span style="font-weight: bold;">Sent:</span></b> Mon, July 12,
2010 12:33:35 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re:
[development] (no subject)<br>
</font><br>
Le lundi 12 juillet 2010 à 09:19 -0700, nan wich a écrit :<br>
> <br>
> Is there an official stance on using hook_schema_alter to add
columns<br>
> to core tables? For example, we collect additional data on
anonymous<br>
> comments and want to actually save that data. Rather than creating<br>
> another table (and subsequent JOINs), I'd just as soon stuff that
data<br>
> into the comments table, where it belongs. Should we ever disable<br>
> comments (unlikely), we probably wouldn't mind losing that data
too.<br>
> <br>
> Nancy E. Wichmann, PMP<br>
> <br>
> Injustice anywhere is a threat to justice everywhere. -- Dr.
Martin L.<br>
> King, Jr.<br>
<br>
I would say, create a new table instead of populating core one.<br>
<br>
Each time you'll update your statistics, it will update the core<br>
database row, which should have not been updated. It will break most of<br>
the DBMS query cache, you will drastically lower your site performances<br>
if you have a lot of data. Ever worst, some DBMS do important physical<br>
row moves on each update (like PostgreSQL), this is no good, if you<br>
don't have to update a row, don't update it.<br>
<br>
You will may also experience some weird behaviors, like other modules<br>
dropping rows and recreating them identically, then loosing your<br>
statistics if they do not use drupal_write_record().<br>
<br>
Pierre.<br>
<br>
<br>
<br>
</div>
</div>
</div>
</blockquote>
</body>
</html>