add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
WITH Machines(id, ip_address) as (
values
(1, '1.1.1.1')
,(2, '1.1.1.2')
,(3, '1.1.1.3')
,(4, '1.1.1.4')
),Schedule(id, machine_id, reserved_date, user_id) as (
values
(1, 1, '2019-10-31', 1)
,(2, 2, '2019-10-10', 2)
,(3, 3, '2019-10-31', 4)
)
SELECT machines.ip_address, schedule.user_id
FROM machines
LEFT JOIN schedule ON schedule.machine_id = machines.id
AND schedule.reserved_date = '2019-10-31';

ip_address user_id
1.1.1.1 1
1.1.1.2 null
1.1.1.3 4
1.1.1.4 null