Hi @Shivendoo Kumar ,
Left join is a very resource-consuming operation. If the associated field is not indexed, the speed is very slow, so if there is a left join, it is best to use the index field to get the association. Or index the associated field.
One million pieces of data is not too much. I used to run one million pieces of data and it only took one or two minutes or less to count.
I tried to rewrite your query,could you please share us your table structure (CREATE TABLE …) and some sample data(INSERT INTO …)along with your expected result? So that we’ll get a right direction and make some test.Only a minimal example is needed.
Can left join be replaced with inner join?If yes, you can try inner join first.
Regards
Echo
If the answer is helpful, please click "Accept Answer" and upvote it.