-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: run and external_users queries (#459)
- Loading branch information
Showing
4 changed files
with
96 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
drop index if exists run_created_at_idx1; | ||
drop index if exists run_created_at_idx3; | ||
drop index if exists run_cost_idx; | ||
drop index if exists run_cost_idx1; | ||
drop index if exists run_created_at_project_id_idx; | ||
drop index if exists run_expr_idx1; | ||
drop index if exists run_expr_idx2; | ||
drop index if exists run_type_external_user_id_idx; | ||
drop index if exists run_type_idx; | ||
drop index if exists run_type_parent_run_id_idx; | ||
|
||
create index on run (project_id, created_at); | ||
create index on run (project_id, cost); | ||
create index on run (project_id, external_user_id); | ||
create index on run (project_id, (error is not null)); | ||
|
||
create index on run (project_id, created_at desc nulls last); | ||
create index on run (project_id, created_at asc nulls last); | ||
create index on run (project_id, duration desc nulls last); | ||
create index on run (project_id, duration asc nulls last); | ||
create index on run (project_id, (prompt_tokens + completion_tokens) desc nulls last); | ||
create index on run (project_id, (prompt_tokens + completion_tokens) asc nulls last); | ||
create index on run (project_id, cost desc nulls last); | ||
create index on run (project_id, cost asc nulls last); | ||
|
||
|
||
analyze; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
drop index if exists external_user_project_id_last_seen_idx; | ||
drop index if exists external_user_last_seen_idx; | ||
drop index if exists external_user_created_at_idx; | ||
|
||
create index on external_user (project_id, created_at desc nulls last); | ||
create index on external_user (project_id, created_at asc nulls last); | ||
create index on external_user (project_id, last_seen desc nulls last); | ||
create index on external_user (project_id, last_seen asc nulls last); | ||
|
||
analyze; |