The first query is very simple. We only fetch the five inclusive records from 500000 to 500004. We chose these values because they are so far into the table that scanning to find them would be very slow. This encourages the remote system to use the index on the aid column, and we can easily tell if it does not.
As we used EXPLAIN VERBOSE, PostgreSQL reports the query that it would have performed on the remote server as well. This is how the full explanation looks on our test server:
PostgreSQL tries to send WHERE clauses to the remote server whenever possible. We can see from the Remote SQL lines that, aside from some inconsequential ...