Hi, I've a self-join with only inequalities (< and >)
on a simple table like this
All the DBMSs I tried are doing a Cartesian product followed by selection which is very expensive any idea on how to do it better? I was thinking about using a variant of sort-merge join? asked Dec 16 '14 at 09:54 momovt Markus Winand ♦♦ |
Well, no. In theory, you are right that theta-joins can be executed using a merge join. How to convince the optimizer to actually do it, is a different story. In general, merge join has gone out of fashion. The only database that I regularly see using it is SQL Server.