You are asking about querying for information that requires learning SQL, not just Django code.
If you have only a thousand owners and cars, everything will be fast enough. If you have a million owners or cars, you need indexes, not necessarily "grouped."
The "clustered" key is implemented in MySQL as a PRIMARY KEY . You can have only one table, and its values must be unique.
I Django, do something like this to get PK:
column1 = models.IntegerField(primary_key = True)
Please provide a table layout that you already have. That is, marry Django and get SHOW CREATE TABLE . (What you provided is too vague, so my answer is too vague.)
Literature:
There are no "clustered" indexes other than PRIMARY KEY . However, the secondary key may have similar performance if it is a “coverage index”. This term refers to an index that contains all the columns found in SELECT . In addition, the columns are ordered correctly.
Look at your SELECT for a better judge of what you need.
Rick james
source share