sql server - SQL Performance with stacking -
i trying understand there performance impact if stack table1
in table2
? better performance?
query #1:
select * table1 id = 100
output:
id col1 col2 ------------- 100 1 0 200 0 1 300 1 0 400 0 1
query #2:
select * table2 id = 100
output:
id col data ---------------- 100 col1 1 100 col2 0 200 col1 0 200 col2 1 300 col1 1 300 col2 0 400 col1 0 400 col2 1
also how sql server scan records?
thanks
table 1 normalized, while table 2 designed eav considered anti-pattern, , reasons.
and while believe performance better table 1,
there other factors considered here besides performance.
imho, reason choose eav design when don't have other choice. (and that's case, since databases today can handle complicated data types such xml or json) in case, choice quite obvious - table 1 has better design, no question it.
Comments
Post a Comment