I have around 50,000 records in my tables A and B(each)Now when I run this query it takes around 10 seconds.SELECT A.id,A.ValueFROM (SELECT id,Value FROM db.Reference where Snapshot_id = 3) AINNER JOIN (select id,Value from db.Reference where Snapshot_id = 2) BUSING (id,Value)
But when I run the same query with a count it takes around 10 secondsSELECT count(*) from (SELECT A.id,A.ValueFROM (SELECT id,Value FROM db.Reference where Snapshot_id = 3) AINNER JOIN (select id,Value from db.Reference where Snapshot_id = 2) BUSING (id,Value)) C
Is there any way to minimize time and optimize query???