Closed ababaian closed 1 year ago
Hey @victorlin, I noticed in this wiki page:
When referenced tables are replaced, these views should be dropped and recreated.
REFRESH MATERIALIZED VIEW
doesn't seem to work in this case.
Since the query for this task depends on the materialized view srarun_geo_coordinates
, there would be some downtime whenever we drop and recreate it. I was wondering, do you remember why the refresh command doesn't work?
I'm not sure how long the materialized view create query takes, but I don't think it's a blocker if we're okay with some downtime.
Hey @lukepereira,
Unfortunately, I don't remember why REFRESH MATERIALIZED VIEW
didn't work. A quick internet search shows that this might have been a RDS instance version problem.
I don't think downtime is a big problem, but to minimize downtime you can use renames instead. Something like:
CREATE MATERIALIZED VIEW new_view AS …;
ALTER MATERIALIZED VIEW live_view RENAME TO old_view;
ALTER MATERIALIZED VIEW new_view RENAME TO live_view;
DROP MATERIALIZED VIEW old_view;
Hey @lukepereira,
Unfortunately, I don't remember why
REFRESH MATERIALIZED VIEW
didn't work. A quick internet search shows that this might have been a RDS instance version problem.I don't think downtime is a big problem, but to minimize downtime you can use renames instead. Something like:
CREATE MATERIALIZED VIEW new_view AS …; ALTER MATERIALIZED VIEW live_view RENAME TO old_view; ALTER MATERIALIZED VIEW new_view RENAME TO live_view; DROP MATERIALIZED VIEW old_view;
This might not work. Last time I renamed a table, it actually renamed every reference of that table automatically across different materialized views. So if there is a view which references a view, it might not update. Exercise caution before dropping table.
Thank you both for the info, I will dig into the docs more to understand what the best options are
Unfortunately, it looks like the cache isn't working as expected and always seems to be empty. It's a blocker for launching since fetching the large number of rows (~93k) is too slow and expensive to run on every map page load. I opened an issue to investigate it here: https://github.com/serratus-bio/serratus-summary-api/issues/38
Some options to consider:
I'll spend more time investigating the options and provide an update soon. We can also discuss this more in person since i'll be in the lab later this week.
This change is live now after fixing the SimpleCache for the geo endpoint (1 from above list).
I will likely continue working on geo related improvements, i.e. (2) and (3) for performance and UX improvements which will also support better filtering capabilities later on. I'll also take a look at the existing geo tasks in the backlog
The beta page for RdRp Geo Map (https://serratus.io/geo) with code components in https://github.com/serratus-bio/serratus.io/tree/main/src/components/Geo is a bit spartan.
The underlying data which the
MapPlot.tsx
function plots is stored in a static CSV file hosted on the servermain/src/components/Geo/rdrp_pos.tsv
and you can see the columns available here:The
rdrp_pos.tsv
file is a downloaded file from the serratuSQL server, based on the materialized view table (for login see: https://github.com/ababaian/serratus/wiki/SQL-Schema)Task:
1) Add a REST API to query to
api.serratus.io
(https://github.com/serratus-bio/serratus-summary-api) to return therdrp_pos
table data from the SQL server2) Add an API call to
Geo
page to download therdrp_pos
table and pass the data toMapPlot.tsx
for plotting.This will allow real-time/updating of the SQL server which will fix the data displayed in Map Geo.