mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-22 01:21:07 +00:00
Add index on Status.remote_id
This field is often used in WHERE-clauses in queries that are very slow on bookwyrm.social.
This commit is contained in:
parent
f28800af7f
commit
4bbdd0b2d0
2 changed files with 22 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 3.2.25 on 2024-04-02 19:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bookwyrm", "0198_book_search_vector_author_aliases"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddIndex(
|
||||
model_name="status",
|
||||
index=models.Index(
|
||||
fields=["remote_id"], name="bookwyrm_st_remote__06aeba_idx"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -80,6 +80,9 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
|||
"""default sorting"""
|
||||
|
||||
ordering = ("-published_date",)
|
||||
indexes = [
|
||||
models.Index(fields=["remote_id"]),
|
||||
]
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""save and notify"""
|
||||
|
|
Loading…
Reference in a new issue