Skip to content

alter_view

The alter_view procedure allows changing a view's query without any down time, which can be useful for migrations. The procedure will create a new view with the new query and will start populating it. Once the new view is ready, it will be swapped with the old view atomically.

Syntax

CALL epsio.alter_view(
    <view_name>, 
    <new_query>, 
);
Parameter Information
view_name The existing view name for which to change the query.
new_query The new query for the view.

Examples

Altering a view:

CALL epsio.alter_view('countries_population',
    'SELECT country.name, sum(city.secondary_population) AS total_population
    FROM playground.country
    JOIN playground.city ON country.code = city.country_code
    GROUP BY country.name');