Skip to content

Commit

Permalink
Add index for channel_id
Browse files Browse the repository at this point in the history
Channel_id is the main query field for nearly every log related database operation and for some reason it isn't indexed. This should speed up all log related database reliant operations especially on large collections
  • Loading branch information
khakers committed Jul 26, 2023
1 parent 9bf357d commit 84820c5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ async def setup_indexes(self):
await coll.create_index(
[("messages.content", "text"), ("messages.author.name", "text"), ("key", "text")]
)
await coll.create_index("channel_id", unique=True)
logger.debug("Successfully configured and verified database indexes.")

async def validate_database_connection(self, *, ssl_retry=True):
Expand Down

0 comments on commit 84820c5

Please sign in to comment.