Closed axiomxd closed 4 years ago
We do, but I've forgotten to add a migration for this after we switched from our old .sql dump to migrations for database setup
We do, but I've forgotten to add a migration for this after we switched from our old .sql dump to migrations for database setup
Does it index parentcid in SubPostComment table? Does it require to index parentcid of SubPostComment. Comment retrieval is using pid of SubPostComment. So does it need to index parentcid.
Yes.
Yes.
I am testing in local development. Why is parentcid need to be indexed? parentcid is not used in where clause for retrieval of comments from database. Pid is used for retrieval of comments. So why there is a need for indexing parentcid? I am confused.
Just double checked and the migrations are already creating most of the required indexes. I just pushed a migration with three more indexes that shouldn't impact everyday use a lot but should help anyway.
Just double checked and the migrations are already creating most of the required indexes. I just pushed a migration with three more indexes that shouldn't impact everyday use a lot but should help anyway.
@migrator.create_model class SubPostComment(pw.Model): cid = pw.CharField(max_length=40, primary_key=True) parentcid = pw.ForeignKeyField(backref='subpostcomment_set', column_name='parentcid', field='cid', model='self', null=True) pid = pw.ForeignKeyField(backref='subpostcomment_set', column_name='pid', field='pid', model=migrator.orm['sub_post'], null=True)
Where is the indexing for pid? Does peewee migration create indexing automatically for foreignkey?
Yes
Why doesn't phuks use any indexing on foreign key field like pid in subcomment table for fast queries/retrieval of data. Thanks