How you can swap the edges of a left take part SQL? –


I’ve two tables that I want to question, tableA has ~53_000 rows whereas tableB has ~530M rows.

SELECT
    b.some_field AS discipline,
    a.*
FROM tableA a 
LEFT JOIN tableB b 
ON a.user_id = b.user_id
AND a.numeric_field >= b.numeric_field
AND a.numeric_field <= b.other_numeric_field
LIMIT 10;

This kills the question engine as a result of the correct hand facet is way greater than the left, so I feel for each row on the left it has to question the correct.

In such case (dimension of proper hand facet being a lot greater than left) what’s the finest to do:

I’m serious about two potentialities:

  • switching up sides and utilizing proper be part of
  • making a doubtlessly a lot smaller desk by querying the rows that exist in the correct hand facet and be part of that desk

Leave a Reply

Your email address will not be published. Required fields are marked *