Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: open
The problem lies in the following:
If there are 4 items on the page that the customer could potentially buy - currently, I insert a new row for each item (4 rows) in to the "sales" table - so that I know the sale has been presented.
If they click on one of those items, I can update the record for that item accordingly as they look at it in closer detail, or buy it. Additionally, it allows me to track the % of visitors that click through to each item and other fun data.
The problem with this is that when querying this database after it's got 900k results or so in it - it gets extremely slow.
I have considered entering all 4 sales attempts as a comma delimited field in a single row - but I'm not sure this is a good idea. I know I have a problem though because given the example above with 4 items on one page, the only thing that differs in each of the 4 rows I insert is the "itemid" - which is the id of the product from the product table.
Any suggestions, greatly appreciated.
previous thread, same issue, but with PHP [webmasterworld.com]
I have no (zero) indexes in my database. I've been reading up on them and familiarizing myself with them and I can't believe I've never been down that road before.
I am self-taught in anything that I know about code or databases, so there tend to be large holes in my knowledge.
It was especially satisfying to see that tremendous gains can be had when using multiple table joins as this table does.
Thank you once again webmasterworld community for coming to my aid.