Jump to content

Archived

This topic is now archived and is closed to further replies.

SupaMonkey

Table/Column optimisation enquiry

Recommended Posts

Ok, so I am gonna jack up my product catalogue script a bit as it is getting slightly outdated. One of the new features is "Other related products"

Now, my question is, which would be better:
1) Adding a column to a products "related_products" and just put csv ID's of other products in there and just explode,etc. whenever i need them
2) Create a new table and create a new record for every related product for each product
3) Something else you guys may think of?



My worthless-based-on-nothing impressions are:
1) Would be faster, more efficient
2) Would be easier to make initially, but slower/less efficient

Any takes on this or any suggestions?

Share this post


Link to post
Share on other sites
No contest - use a separate table.

If you have a csv field of id's you can't join those ids to the product file to get descriptions etc of the related products.

[code]
product              related_prods
----------           --------------
prod_id     <----+    rec_id
description      |
price            +--- prod_id
                 |
                 +--- rel_prod_id
[/code]

Share this post


Link to post
Share on other sites
Couldnt I just retrieve the CSV column then explode it, then loop through it and get each id's data with a query?

Share this post


Link to post
Share on other sites
Yes. You could go the whole hog, uninstall MySql and just use a text file.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.