[thelist] sql/table design question
rudy
r937 at interlog.com
Tue Feb 18 17:31:01 CST 2003
>> bookID1
>> bookID2
>
> ... I always have a tough time deciding whether to insert one record
> for each direction or update the select queries to search both fields.
> I prefer the former for speed and maintenance considerations, but it
> seems like it's basically doubling the amount of data.
i think it's six of one and a dozen of the other
;o)
if it is truly bidirectional, i would use only one row, and query both
sides, as appropriate
if you insert two rows, you leave the possibility open that eventually
you'll have a situation where A relates to B but B doesn't relate to A
now, if that's the real world situation that it's supposed to model (like,
book A mentions book B but book B doesn't mention book A), then that's fine,
but if it's not, and your logic isn't rock solid, eventually you'll have a
logical inconsistency (missing row)
and users are great at spotting those situations before you do
if it's supposed to be bidirectional, then i don't see what the extra rows
buy you, and i don't understand how the extra rows are faster
rudy
More information about the thelist
mailing list