Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code example for creating custom postgres indexes via post-hook #4568

Open
1 task done
dbeatty10 opened this issue Dec 1, 2023 · 0 comments
Open
1 task done

Code example for creating custom postgres indexes via post-hook #4568

dbeatty10 opened this issue Dec 1, 2023 · 0 comments
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear

Comments

@dbeatty10
Copy link
Contributor

Contributions

  • I have read the contribution docs, and understand what's expected of me.

Link to the page on docs.getdbt.com requiring updates

https://docs.getdbt.com/reference/resource-configs/postgres-configs#indexes

What part(s) of the page would you like to see updated?

Would be good to put the following advanced example from dbt-labs/dbt-core#9185 in an example box or put in a Discourse post and link to the Index section within the Postgres page.

In dbt-labs/dbt-core#9185 the poster gave this code example for using the gin or gist index types from the pg_trgm extension module using the gin_trgm_ops operator class (opclass):

{{
    config(
        indexes=[
            {"columns": ["my_regular_column"], "type": "btree"},
        ],
        post_hook=[
            "create index my_1st_ext_index on {{ this }} using gin (my_1st_ext_column gin_trgm_ops);",
            "create index my_2nd_ext_index on {{ this }} using gist (my_2nd_ext_column gist_trgm_ops);",
            "create index my_3rd_ext_index on {{ this }} using gist (my_3rd_ext_column gist_trgm_ops(siglen=32));",
        ]
    )
}}

Warning

I didn't actually test out the code example above. I also didn't give much thought to the name of the example columns and indexes. The cde should be tested for correctness and the names should be aligned with relevant style guides.

Additional information

No response

@dbeatty10 dbeatty10 added content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear labels Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content improvement Use this when an area of the docs needs improvement as it's currently unclear
Projects
None yet
Development

No branches or pull requests

1 participant