Are there differences in speed between those 3 queries? They all return the same.
The data structure of this MRE is two tables: tests and id_tests.
- testshave 3 columns (- unique_id, allele, mfi_valeur). Primary key:- unique_id. It's also a foreign key that references- unique_idfrom the second table- id_tests.
- id_testshave 2 columns (- unique_id, type_test). Primary key:- unique_id.
SELECT i.type_test
  FROM [DATA_CQE].[dbo].[tests] as t, [DATA_CQE].[dbo].[id_tests] as i
  WHERE t.unique_id = i.unique_id
  AND t.allele = 'A*01:01'
  AND t.mfi_valeur > 10000;
SELECT i.type_test
  FROM [DATA_CQE].[dbo].[tests] as t
  JOIN [DATA_CQE].[dbo].[id_tests] as i
  ON t.unique_id = i.unique_id
  WHERE t.allele = 'A*01:01'
  AND t.mfi_valeur > 10000;
SELECT type_test 
FROM [DATA_CQE].[dbo].[id_tests]
WHERE unique_id IN (
  SELECT unique_id
  FROM [DATA_CQE].[dbo].[tests]
  WHERE allele = 'A*01:01'
  AND mfi_valeur > 10000
);
Here are the query plans: https://www.brentozar.com/pastetheplan/?id=BJWQF89r3. I'm not sure I'm fully aware how I should read it. The queries are insanely fast because I truncated my database for the tests (instead of several tens of millions of rows I only left tens of thousands).
What are the rules to determine what is the best way to do such queries and how would one reliably test differences between queries?
 
    