Improve queries with selective sync by shard

parent b6179a0e
......@@ -20,8 +20,7 @@ module Geo
def execute
return Geo::Fdw::Project.none unless valid_shard?
current_node
.projects
projects
.missing_project_registry
.within_shards(shard_name)
.limit(batch_size)
......@@ -32,6 +31,12 @@ module Geo
attr_reader :current_node, :shard_name, :batch_size
def projects
return Geo::Fdw::Project.all if current_node.selective_sync_by_shards?
current_node.projects
end
def valid_shard?
return true unless current_node.selective_sync_by_shards?
......
......@@ -20,8 +20,7 @@ module Geo
def execute
return Geo::Fdw::Project.none unless valid_shard?
current_node
.projects
projects
.recently_updated
.within_shards(shard_name)
.limit(batch_size)
......@@ -32,6 +31,12 @@ module Geo
attr_reader :current_node, :shard_name, :batch_size
def projects
return Geo::Fdw::Project.all if current_node.selective_sync_by_shards?
current_node.projects
end
def valid_shard?
return true unless current_node.selective_sync_by_shards?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment