Z Order in Delta Lake organizes data in storage to minimize the amount of data that needs to be scanned for certain queries, improving query performance.
In the example above, without Z Order optimization, the query has to scan through 8 separate files to find rows where id = 5. However, with Z Order optimization, the query only needs to scan one file to locate the desired rows.