Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of the History page queries #981

Open
1 of 3 tasks
stuartc opened this issue Jul 27, 2023 · 2 comments
Open
1 of 3 tasks

Improve performance of the History page queries #981

stuartc opened this issue Jul 27, 2023 · 2 comments
Labels
architecture Issue related to the architecture of the lightning needs detail More detail is needed before development can start

Comments

@stuartc
Copy link
Member

stuartc commented Jul 27, 2023

Coming off #968.

We have several places where performance of the History page query is hampered, here is a list of things I noticed:

  1. We should not cast columns when searching, for example both log_lines and the dataclip tables have their columns cast into varchars - this is very expensive.
  2. Finding the last run by joining on finished_at is exponentially less efficient depending on how many attempts & runs there are.

Proposed solutions

These solutions are distinct (and should be done regardless) from taking another approach which is creating aggregate tables

  1. Create aggregate (or columns) that get updated when an attempt/run is created or updated. Removing the need to join and filter Runs by exit code and finished_at.

References:

invocation.ex:417 - list_work_orders_for_project_query/2

@stuartc stuartc added architecture Issue related to the architecture of the lightning needs detail More detail is needed before development can start labels Jul 27, 2023
@taylordowns2000 taylordowns2000 moved this to Icebox in v2 Feb 3, 2024
@christad92 christad92 added Launch MVP Features that are critical to launching the MVP epic labels Mar 17, 2024
@christad92 christad92 moved this from Icebox to Backlog in v2 Mar 17, 2024
@jyeshe
Copy link
Member

jyeshe commented Mar 18, 2024

@stuartc, @taylordowns2000 back then when we were discussing about which partition to use for logs, I have talked about the benefits of easier records cleanup (drop expired partitions) and narrowing the query scope to a specific partition when user filters by date. For the incremental search on History Page approach, it might be an opportunity before the launch to switch the logs partitioning to by range.

@stuartc
Copy link
Member Author

stuartc commented Mar 18, 2024

We'll need to make some synthetic benchmarks to know where our performance dropoff is unacceptable. Changing now will be quite a bit of work, and changing back (or any other flavour of partition) later will be even more difficult. We already have production data in the tables so we have to treat it as critical.

@christad92 christad92 removed Launch MVP Features that are critical to launching the MVP epic labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architecture Issue related to the architecture of the lightning needs detail More detail is needed before development can start
Projects
Status: Backlog
Development

No branches or pull requests

3 participants