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

[CT-3439] [Feature] Support for postgres index extensions #9185

Closed
3 tasks done
scottgigante opened this issue Nov 30, 2023 · 4 comments
Closed
3 tasks done

[CT-3439] [Feature] Support for postgres index extensions #9185

scottgigante opened this issue Nov 30, 2023 · 4 comments
Labels
enhancement New feature or request wontfix Not a bug or out of scope for dbt-core

Comments

@scottgigante
Copy link
Contributor

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

Developers should easily be able to select indices from installed extensions -- e.g. I would like to use a gin index from pg_trgm.

Describe alternatives you've considered

This is the clearest workaround, but it's not obvious to new users and it's counterintuitive to do something different for this index than for other regular indices.

{{
    config(
        indexes=[
            {"columns": ["my_regular_column"], "type": "btree"},
        ],
        post_hook=[
            "create index my_extension_index on {{this}} using gin (my_extension_column gin_trgm_ops);"
        ]
    )
}}

Who will this benefit?

This will benefit users of Postgres who wish to add indices that are not supported out of the box.

Are you interested in contributing this feature?

Unfortunately I don't have the time.

Anything else?

No response

@scottgigante scottgigante added enhancement New feature or request triage labels Nov 30, 2023
@github-actions github-actions bot changed the title [Feature] Support for postgres index extensions [CT-3439] [Feature] Support for postgres index extensions Nov 30, 2023
@dbeatty10
Copy link
Contributor

Thanks for proposing this @scottgigante !

Something we'll often say that we want dbt to "make easy things easy and hard things possible". Since this proposal involves an optional postgres exension, we would put this in the "hard" category rather than the "easy" category. So our aspiration would be to make this at least possible (even if we can't / won't make it easy).

If we were to implement this, the syntax might look like this:

{{
    config(
        indexes=[
            {"columns": ["my_regular_column"], "type": "btree"},
            {"columns": ["my_1st_ext_column"], "type": "gin", "opclass": "gin_trgm_ops"},
            {"columns": ["my_2nd_ext_column"], "type": "gist", "opclass": "gist_trgm_ops"},
            {"columns": ["my_2nd_ext_column"], "type": "gist", "opclass": "gist_trgm_ops(siglen=32)"}
        ]
    )
}}

But since it is possible right now via post-hooks and not a priority for us to implement ourselves or accept an open source contribution, I'm going to close this as "not planned".

p.s.
Agreed that the workaround is not obvious to new users and it's counterintuitive to do something different for trigram-based indexes like gist (Generalized Search Tree) or gin (Generalized Inverted Index) from the pg_trgm extension module. So we should supplement the documentation for Postgres indexes with code examples similar to what you provided.

Here's the issue I've opened for that supplemental documentation: dbt-labs/docs.getdbt.com#4568.

@dbeatty10 dbeatty10 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@dbeatty10 dbeatty10 added wontfix Not a bug or out of scope for dbt-core and removed triage labels Dec 1, 2023
@scottgigante
Copy link
Contributor Author

Thanks @dbeatty10, that explanation makes a lot of sense and the proposed docs addition solves 90% of the problem. Thank you!

@philippemnoel
Copy link

Would love to get support for pg_bm25 in dbt as well! https://github.com/paradedb/paradedb

@aibunny
Copy link

aibunny commented Mar 8, 2024

Would love to get support for pg_bm25 in dbt as well! https://github.com/paradedb/paradedb

I also want this too, looking to use dbt in parade db and want my tables as parquets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix Not a bug or out of scope for dbt-core
Projects
None yet
Development

No branches or pull requests

4 participants