Match queries with their plans

Report a typo

Below you see SQL-queries and plans. Can you match them?

Match the items from left and right columns
SELECT count(employee_id) FROM salary WHERE to_date IS NULL;
SELECT employee_id, max(salary_amount) FROM salary WHERE to_date IS NOT NULL GROUP BY employee_id;
SELECT 1+1 ORDER BY 1;
SELECT max(salary_amount) FROM salary WHERE to_date IS NULL;
-> Group aggregate: max(salary.salary_amount)
   -> Filter: (salary.to_date is not null) (cost=287719.24 rows=2481047)
       -> Index scan on salary using idx_employee_id (cost=287719.24 rows=2756719)
-> Rows fetched before execution (cost=0.00 rows=1)
-> Aggregate: max(salary.salary_amount)
  -> Filter: (salary.to_date is null) (cost=287719.24 rows=275672)
      -> Table scan on salary (cost=287719.24 rows=2756719)
-> Aggregate: count(salary.employee_id)
  -> Filter: (salary.to_date is null) (cost=287719.24 rows=275672)
      -> Index scan on salary using ak_salary (cost=287719.24 rows=2756719)
___

Create a free account to access the full topic