3 ms·
In this case it was a left join sometable on sometable.someuid = isnull(someothertable.someuid, somethirdtable.someuid) I guess that is such an uncommon case
by Akronymus 6y ago
In this case it was a
left join sometable on sometable.someuid = isnull(someothertable.someuid, somethirdtable.someuid)
I guess that is such an uncommon case that it tripped up the optimizer completely.
Also: Thanks for writing "polymorphic associations". Not knowing that probably is why I struggled to find any info on it.
Edit: Both tables were actually the same one, just retrieved via different joins, so different data.[1]
[1]One was a company, the other was the company we need to send money to. This is for when deal with a daughter company but pay the parent company directly, for example.
- AmericanChopper 6y ago> Thanks for writing "polymorphic associations". Not knowing that probably is why I struggled to find any info on it. We might have had a similar experience with this. The first time I stumbled across this problem though I was specifically trying to figure out “what is the relational way to implement polymorphism”, so I pretty much lucked into the a rather productive series of google searches.
- Akronymus 6y agoIt wasn't strictly polymorphism, but the term you wrote led me to a article[1] where it mentioned "alternative parent". This alone instantly made the problem more understandable for me. [1]http://duhallowgreygeek.com/polymorphic-association-bad-sql-smell/ http://duhallowgreygeek.com/polymorphic-association-bad-sql-...