basically you add a where condition in your merge query.
F.E. let's say your target table is partitioned by year. Your incoming data contains only data of the current year.
If you want to merge, you can add a where <partitioncolumn> = 2022. This dramatically reduces the data read.
An example (in scala but python is almost the same):
spark.sql(s"""
|MERGE INTO $targetTableName
|USING $updatesTableName
|ON $targetTableName.par IN (1,0) AND $targetTableName.id = $updatesTableName.id
|WHEN MATCHED THEN
| UPDATE SET $targetTableName.ts = $updatesTableName.ts
|WHEN NOT MATCHED THEN
| INSERT (id, par, ts) VALUES ($updatesTableName.id, $updatesTableName.par, $updatesTableName.ts)
"""