Skip to main content

DuckDB_Connection.create_index

create_indextablekey_columnsasreplace_if_present

Group: Database

Documentation

Creates an index on an existing table.

Arguments

  • table: the table name or a DB_Table to create the index on.
  • key_columns: the names of the columns to use as the index.
  • as: the name of the index to create. Defaults to <table>_INDEX.
  • replace_if_present: if set to True, will replace the index if it already exists.

Returns

A DB_Table referencing the newly created table.