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-3407] [Feature] Support for tablespaces in PostgreSQL #9122

Closed
3 tasks done
ggam opened this issue Nov 20, 2023 · 2 comments
Closed
3 tasks done

[CT-3407] [Feature] Support for tablespaces in PostgreSQL #9122

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

Comments

@ggam
Copy link

ggam commented Nov 20, 2023

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

PostgreSQL allows you to define tablespaces and store each table and index on a different tablespace. This is pretty useful when fast disk are not available for the whole database.

It would be great if dbt allowed you to specify the tablepace at model (table) and index level. For example:

{{ config(
    materialization = 'table'
    tablespace = 'reporting_tablespace'
    indexes=[
        {
            'columns': ['id']
            'tablespace': 'index_tablespace'
        }
    ]
)}}

Describe alternatives you've considered

I'm using pre and post hooks to route reporting tables to a specific tablespace:

    intermediate:
      materialized: "table"
      schema: intermediate
      +unlogged: true

    marts:
      materialized: "table"
      schema: marts
      +pre-hook: 'set "default_tablespace" to "marts_tablespace"'
      +post-hook: 'set "default_tablespace" to default'

But now I'd like to move only the indexes to another tablespace. I can't set a "default index tablespace" on Postgres so my only option now is to create the indexes via post hooks instead of the native option.

Who will this benefit?

Everyone using tablespaces in Postgres.

Are you interested in contributing this feature?

I probably could, if you guide me a bit where to look.

Anything else?

No response

@ggam ggam added enhancement New feature or request triage labels Nov 20, 2023
@github-actions github-actions bot changed the title [Feature] Support for tablespaces in PostgreSQL [CT-3407] [Feature] Support for tablespaces in PostgreSQL Nov 20, 2023
@dbeatty10 dbeatty10 self-assigned this Nov 21, 2023
@dbeatty10
Copy link
Contributor

Thanks for writing this up so well @ggam !

When adding new features to dbt-core, a big criteria for us is applicability -- whether a feature is supported across multiple databases. Another is impact -- how commonly a feature is needed. Ease of implementation is also a factor. There are other potential decision-making factors, but the last I'll mention now is possibility -- whether or not it's already reasonably possible already.

Since this feature is only specific to postgres and is relatively niche (but is still possible via hooks), I'm going to close this feature request as "not planned".

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

ggam commented Nov 21, 2023

@dbeatty10 I agree this is a very niche case. Note though that using hooks is not (currently) an option for specyfing the index tablespace. #8999 will help with this, as I'll be able to set a known index name and alter index.

In order to implement this correctly in user land, I'd need an "index creation pre/post hook". But yes I know, that's even more niche use case so I'll hope for #8999 to be merged as a workaround.

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

2 participants