Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: ACS LLC
I have a table that has two fields in there, let's say field1 and field2.
I need to somehow join these together to get a distinct list of records from each, as if they were one, so for example
field1,field2
1,10
1,12
4,1
6,1
If I query WHERE field1=1 or field2=1
I need to get one one result 10,12,4,6 which gives me all the records relating to record 1 regardless of the order
Can anybody help me with this?
Thanks
Mark
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:Oooooh, VERY bad idea..... very BAD design. By denormalizing your data, you are asking for many more problems than you think that you are solving.
.....where I store a list of comma delim' numbers in one field
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: ACS LLC
Really?
I only ever have to search by the unique UID of the user, so if I need the record for user 123 I just search on the user record for user_uid=123 and I retrieve the list, I will never have to search through the list in SQL, just get the data
My concern on top of the complex code is that if I have let's say 200,000 members, and each one has an average of say 25 'friends', that's 5,000,000 records... and I actually anticipate a LOT more with potentially higher averages per person... I'm relucant to have a query gather a record set from a list that could span 10-20M or more records for multiple users at the same time... could get ugly.
I could always 'undo' the work I've done as we grow, but I can't see any problems with the way I'm doing it...yet! ;-)
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
quote:
Originally posted by: ACS LLC
I pretty much understand his solution, it is more or less the same as my first approach. But the huge amount of records that I could create is still of concern to me.
The largest set of records I've ever handled was around 26M, at this point even with indexing in the right places it started to slow down. This site could have similar amounts but more hits.
What sort of problems do you forsee if I do it the other way with one record and a comma delim' list? note that I won't search that list only the uid of the person (member) that I need to refer to
Copy link to clipboard
Copied
quote:
Originally posted by: Dan Bracuk
Put in a few thousand records and see how fast that one is.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied