pg_add_index: Create an index

Description Usage Arguments Value

View source: R/postgres.r

Description

Create an index

Usage

1
2
3
4
5
6
7
pg_add_index(
  con,
  table_name,
  indexed_col,
  unique_index = FALSE,
  drop_existing = FALSE
)

Arguments

con

A DBI connection to a postgresql database

table_name

The name of a table in the postgresql database

indexed_col

Columns or an expression on columns to index

unique_index

Force index to be unique?

drop_existing

Drop index if it already exists?

Value

The name of the created index

Note, postgres is smart enough that you don't need to index a column that's already unique, but if you want to ALTER TABLE to make a primary key, you have to start with a unique index.


karldw/kdw.junk documentation built on Sept. 8, 2021, 9:30 p.m.