> Marc, I am using postgres 9.4. I didn't benchmark, but intuitively the modulo 
> operator will force traversing every record in table "a" 4 times, as it can't 
> use an index.

Not necessarily. seq scans can be synchronized:

"This allows sequential scans of large tables to synchronize with each other, 
so that concurrent scans read the same block at about the same time and hence 
share the I/O workload. When this is enabled, a scan might start in the middle 
of the table and then "wrap around" the end to cover all rows, so as to 
synchronize with the activity of scans already in progress. This can result in 
unpredictable changes in the row ordering returned by queries that have no 
ORDER BY clause."

Marc

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to