@@ -17,25 +17,39 @@ Conflict Avoidance
1717------------------
1818
1919It is important to note that if the field has the ``primary_key `` or ``unique `` attribute set, but it is not a partitioned field, we will ignore the
20- `PRIMARY KEY ` or `UNIQUE ` declarations for that field in the SQL statement generated by Django. Django itself ignores the ``db_index ``
20+ `` PRIMARY KEY `` or `` UNIQUE ` ` declarations for that field in the SQL statement generated by Django. Django itself ignores the ``db_index ``
2121attribute of such fields, so you cannot use this method to create field indexes.
2222
23+ A workaround is to add a ``indexes `` declaration in your model, for example
24+
25+ .. code-block :: python
26+
27+ @TimeRangePartitioningSupport (" timestamp" )
28+ class DataTable (models .Model ):
29+ id = models.BigIntegerField(primary_key = True , serialize = False )
30+ timestamp = models.DateTimeField()
31+ data = models.TextField()
32+
33+ class Meta :
34+ # If you do not add this line, id field will not have a index
35+ indexes = (models.Index(fields = (" id" , )), )
36+
2337 Tablespace
2438----------
2539
26- django-partitioning will silently set the tablespace of all local partitioned indexes under one partition to be consistent with
40+ `` pg_timepart `` will silently set the tablespace of all local partitioned indexes under one partition to be consistent with
2741the partition.
2842
2943Partition Information
3044---------------------
3145
32- django-partitioning persists partition configuration and state information with ` PartitionConfig ` and `PartitionLog `.
33- The problem with this is that once this information is inconsistent with the actual situation, django-partitioning
34- will not work properly, and you can only fix it manually.
46+ `` pg_timepart `` saves partition configuration and state information in `` PartitionConfig `` and `` PartitionLog ` `.
47+ The problem with this is that once this information is inconsistent with the actual situation, `` pg_timepart ``
48+ will not work properly, so you can only fix it manually.
3549
3650Management
3751----------
3852
3953You can use ``Model.partitioning.create_partition `` and ``Model.partitioning.detach_partition `` to automatically create and
40- archive partitions. In addition setting `default_detach_tablespace ` and `default_attach_tablespace `, you can also use the
54+ archive partitions. In addition setting `` default_detach_tablespace `` and `` default_attach_tablespace ` `, you can also use the
4155``set_tablespace `` method of the PartitionLog object to move the partition. See :doc: `api ` for details.
0 commit comments