Skip to content

What about having helpers for indexes analysis? #282

@EQuincerot

Description

@EQuincerot

Hello,

First of all, thanks for your gem! That's very useful.

I developed some wrapper to pg_query to ease the parsing of pg_query tree for indexes.
Do you think that would be valuable to include that in pg_query?

Example:

my_indexes = IndexDefinition.list(connection)
my_indexes = IndexDefinition.list(connection, pattern: '%deleted_at IS NULL%')
my_indexes = IndexDefinition.list(connection, table_name: 'accounts')

On IndexDefinition class we would have such methods:

  • #name
  • #table_name
  • #definition
  • #composite?
  • #indexed_columns
  • #partial_index?
  • #where_clause

If you think it's interesting I could prepare a PR for that.
If not, I would probably create a dedicated project :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions