Skip to content

Define several indexes with target_options -> table_keys #747

@flarco

Description

@flarco

Discussed in #743

Originally posted by igrpon May 26, 2026
There is index key in table_keys section, however - is there a way to define several indexes on different set of columns ?

Currently it is like this (ref: #225 or https://docs.slingdata.io/concepts/replication/target-options)

streams:
  my_stream:
    target_options:
      table_keys:
        index: [col1, col2]

I want to:

streams:
  my_stream:
    target_options:
      table_keys:
        index: 
          - index1: [col1, col2]
          - index2: [col3]

Maybe there are some YAML tricks or not-documented way to do so ? Tried several options - nothing works :(
(sling accepts if I put severl index keys, but only the first index is created, others are skipped)

ALSO:
I suggest loose validation and checks sling does on list of columns in index: [col1, col2] - currently only defined & known columns are allowed, however - in Postgres & other DBs it is possible to define expression indexes - indexes that are based on functions/expressions from columns data. E.g.

CREATE INDEX ind_expressoion ON table (LOWER( CONCAT(col1, col2) ))

this is blocked by sling - sling checks if the expression LOWER( CONCAT(col1, col2) ) is existing column, but this is 100% correct

@flarco - I think it's better to issue a WARN here, but not block SQL execution (or add some CLI / YAML option to allow that)

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions