-
Notifications
You must be signed in to change notification settings - Fork 0
Description
There has been quite a bit of work in the backend to increase performance on the detections view. This includes running queries via a new sql function and using pagination:
query <- glue::glue_sql(
.con = my_con,
"SELECT * FROM acoustic.ltdd_get_detection_ids(
{next_id_pk},
{limit},
true,
_projectcode := '2013_albertkanaal',
_network_project_code:= null,
_start_date := null,
_end_date:= null, _acoustic_tag_id:= null
, _scientific_name:= null
, _receiver_id:= null
);"
)Stijn email thread: detections view functie test
Implementation should happen in this package, and come upstream after [inbo/etn]: v2.3.1 is merged, or as part as via the etnservice dependency.
2 Views
There are two views:
- detections_animal
- detections_network
I understand that based on a condition either one or the other view is required.
Switching views
When there is a query on animal, use acoustic.detections_animal, otherwise use acoustic.detections_network
Progress bar
It's possible to do a COUNT on the query beforehand to see what the number of returned records will be, and use this to provide some sort of progress reporting.
Proposed approach
We are running up to the OpenCPU Serializer limitations, thus client side pagination is the solution. The client fetches the pages one by one.
- COUNT to get total number of records: progress reporting -> Need to know the correct view?
- Fetch pages one by one
- Combine them