Jump to content


Photo

Table/Column optimisation enquiry


  • Please log in to reply
3 replies to this topic

#1 SupaMonkey

SupaMonkey
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationSouth Africa

Posted 23 May 2006 - 10:07 AM

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?
Website design, development & web hosting | 4x4 Electrical & Hydraulic Winches | Car Parts, Accessories, Styling, Lambo/Body/HID/Xenon Kits | Escorts, strippers & adult clubs directory | Adult Website design, development & web hosting

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 23 May 2006 - 06:53 PM

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.

product              related_prods
----------           --------------
prod_id     <----+    rec_id 
description      |
price            +--- prod_id
                 |
                 +--- rel_prod_id

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 SupaMonkey

SupaMonkey
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationSouth Africa

Posted 24 May 2006 - 07:56 AM

Couldnt I just retrieve the CSV column then explode it, then loop through it and get each id's data with a query?
Website design, development & web hosting | 4x4 Electrical & Hydraulic Winches | Car Parts, Accessories, Styling, Lambo/Body/HID/Xenon Kits | Escorts, strippers & adult clubs directory | Adult Website design, development & web hosting

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 24 May 2006 - 07:30 PM

Yes. You could go the whole hog, uninstall MySql and just use a text file.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users