SQL 2014: Alternate solution for CROSS JOIN in SQL

  • Hello Experts,

    In one of my codes, I had to use CROSS JOIN with MonthIDs as I am going to do End of Period in the later stage. But as we know, CROSS JOIN takes lot of time because it’s almost ~8M * ~44 = ~350M of rows.

    Do we have any alternate solution in place of CROSS JOIN in SQL which can work faster?

    Any help would be greatly appreciated!

    Thank You!

    Srinivas

  • You'll have to provide more details on what you are trying to achieve. A cross join is a product of all possibilities. If that's what you need, that's what you write.

    If you are solving another problem, provide some DDL and sample data, and explain what you'd like to achieve and have tried.

  • You could just limit the monthids that you're cross joining with.

  • I did reduce the MonthIDs, even after the volume is quite high but now, I am trying for alternative solution itself (not an alternate to Cross Join). Hoping, that will fix my issues.

    Thank You!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply