Class: Smriti::Services::SwapRefresh
- Inherits:
-
BaseService
- Object
- BaseService
- Smriti::Services::SwapRefresh
- Defined in:
- lib/smriti/services/swap_refresh.rb
Overview
Service that performs a swap-style refresh of a materialised view.
Instead of locking the existing view, this strategy builds a new temporary materialised view and atomically swaps it in. This approach minimizes downtime and allows for safer rebuilds of large views.
Steps:
- Create a temporary MV from the provided SQL.
- In a transaction: rename original → old, tmp → original, drop old.
- Recreate declared unique indexes (if any).
Options:
row_count_strategy:(Symbol, default: :none) → one of:estimated,:exact, or:none or nilto control row count reporting
Returns a Smriti::ServiceResponse
Constant Summary
Constants inherited from BaseService
BaseService::ALLOWED_ROW_STRATEGIES, BaseService::DEFAULT_NIL_STRATEGY, BaseService::DEFAULT_ROW_STRATEGY, BaseService::UNKNOWN_ROW_COUNT
Instance Attribute Summary
Attributes inherited from BaseService
#definition, #request, #response, #row_count_strategy, #use_transaction
Method Summary
Methods inherited from BaseService
Constructor Details
This class inherits a constructor from Smriti::Services::BaseService