Skip to content

Conversation

@helloiamlukas
Copy link
Contributor

To improve perfomance for Postgres databases, the json columns can use the jsonb data type.

This is will reduce responsetimes drastically when dealing with large datasets.

@helloiamlukas helloiamlukas changed the title Use jsonb data type for PostgresSQL to increase perfomance Use jsonb data type for PostgreSQL to increase perfomance Oct 25, 2022
Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@what-the-diff
Copy link

what-the-diff bot commented Nov 2, 2022

  • Changed the column type of settings from json to jsonb in asset containers table.
  • Changed the column type of data from json to jsonb in assets meta table.
  • Changed the column type of data from json to jsonb in blueprints table and added a unique index on handle and namespace columns together as they are used for querying data by both fields combined (handle,namespace).
  • Same changes as above but with collections instead of blueprints: changed settings field's datatype from JSON to JSONB, also made it nullable since this is not required when creating new collection entries via API or UI; Also created an index on handle because we query based on that value alone sometimes (eager loading) - see https://github.com/statamic/cms/blob/master-v3/.github%2FISSUE_TEMPLATE%2FFEATURE_REQUEST-COLLECTION_ENTRY_INDEXES_.md#indexes .

@helloiamlukas
Copy link
Contributor Author

Yes, you are right. I removed them now. Thanks for the hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants