Skip to content

Instantly share code, notes, and snippets.

@vubon
Last active January 29, 2022 06:01
Show Gist options
  • Save vubon/d154c4f8a250b0ec1d485d007f62eaf1 to your computer and use it in GitHub Desktop.
Save vubon/d154c4f8a250b0ec1d485d007f62eaf1 to your computer and use it in GitHub Desktop.
Django BRIN index in PostgreSQL Database
from django.contrib.postgres.indexes import BrinIndex
from django.db import models
class SampleData(models.Model):
created_at = models.DateTimeField()
class Meta:
"""
You must need to use PostgreSQL DB unless you can't use BrinIndex
"""
indexes = (
BrinIndex(fields=['created_at']),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment