Well,
I like your idea, but why not fill the title table automagically as you find new headers? Then you don't need the title_id 3 in your example.

But I am still not sure how much the performance gain is by putting it into separate tables compared to searching on the message blocks.

Magnus

Ed K. wrote:
This is for digestion:

I like the seperate tables, and to show my point, here are some sql examples:

mysql> select version();
+---------------------+
| version()           |
+---------------------+
| 4.0.12-standard-log |
+---------------------+
1 row in set (0.00 sec)

mysql> select * from title;
+----+----------+
| id | title    |
+----+----------+
|  1 | From:    |
|  2 | To:      |
|  3 |          |
|  4 | Subject: |
+----+----------+
4 rows in set (0.00 sec)

mysql> select * from header;
+----+----------+--------------------------------------------+
| id | title_id | header                                     |
+----+----------+--------------------------------------------+
|  1 |        1 | [EMAIL PROTECTED]                                  |
|  2 |        2 | [EMAIL PROTECTED]                                  |
|  4 |        3 | unknown header1: this is an unknown header |
|  5 |        4 | test message                               |
|  6 |        3 | unknown header3: this is an unknown header |
+----+----------+--------------------------------------------+
5 rows in set (0.00 sec)

mysql> select IF (title.id=3,header.header,concat(title.title ," ", 
header.header)) as header from header join title on title.id=header.title_id order by
header.id;
+--------------------------------------------+
| header                                     |
+--------------------------------------------+
| From: [EMAIL PROTECTED]                            |
| To: [EMAIL PROTECTED]                              |
| unknown header1: this is an unknown header |
| Subject: test message                      |
| unknown header3: this is an unknown header |
+--------------------------------------------+
5 rows in set (0.00 sec)




Reply via email to