Define your first query
In order to define a query which will be handled by Epsio, just call epsio.create_view
in your original database:
CALL epsio.create_view('revenue_per_genre',
'SELECT movies.genre genre, sum(purchases.price) revenue
FROM purchases
LEFT JOIN movies on movies.id = purchases.movie_id
GROUP BY movies.genre');
From that point on, Epsio will maintain the results of that query, updating it incrementally as changes are made.
Query ViewsΒΆ
In order to retrieve the results, just query the new results table within the original database:
Since Epsio views function just like any other PostgreSQL view/table, you can also run more complex queries on top of the views you create: