I want to perform large number of queries to filter by tag, on a postgre table
from sqlalchemy.dialects.postgresql import ARRAY
class Post(db.Model):
__tablename__ = 'post'
id = db.Column(db.Integer, primary_key=True)
tags = db.Column(ARRAY(db.String))
This link recommends storing tags as text array with a GIN index.
How do I add GIN index to above table? Also does it make a difference whether I use String
vs Text
datatype?