-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add index to speed up get last attempt (#3636)
* add index to speed up get last attempt * use descending order * put back unique param * how did this not get formatted? --------- Co-authored-by: Richard Kuo (Danswer) <rkuo@onyx.app>
- Loading branch information
1 parent
7f6ef1f
commit 97a963b
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
backend/alembic/versions/369644546676_add_composite_index_for_index_attempt_.py
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,35 @@ | ||
"""add composite index for index attempt time updated | ||
Revision ID: 369644546676 | ||
Revises: 2955778aa44c | ||
Create Date: 2025-01-08 15:38:17.224380 | ||
""" | ||
from alembic import op | ||
from sqlalchemy import text | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "369644546676" | ||
down_revision = "2955778aa44c" | ||
branch_labels: None = None | ||
depends_on: None = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index( | ||
"ix_index_attempt_ccpair_search_settings_time_updated", | ||
"index_attempt", | ||
[ | ||
"connector_credential_pair_id", | ||
"search_settings_id", | ||
text("time_updated DESC"), | ||
], | ||
unique=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index( | ||
"ix_index_attempt_ccpair_search_settings_time_updated", | ||
table_name="index_attempt", | ||
) |
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