pg: Rewrite _origin_query to force the query planner to filter on URLs before filtering on visits.
URL filters usually have a few matches and use the index; whereas filtering
on visits requires to scan the entire origin table first.
This makes the query considerably faster.
Credit for the idea goes to @olasd.