Create index in database

create_index(
  con,
  tbl,
  flds,
  is_geom = F,
  is_unique = F,
  overwrite = F,
  show = F,
  exec = T
)

Arguments

con

database connection object from DBI::dbConnect(), e.g. from cc_db_connect()

tbl

table name as character

flds

character vector of fields in table used for index

is_geom

logical (default: FALSE) whether geometry field, so create GIST() index

is_unique

logical (default: FALSE) whether to impose a unique constraint, to prevent duplicates; default: FALSE

overwrite

logical (default: FALSE) whether to overwrite existing index

show

logical (default: FALSE) whether to show SQL statement

exec

logical (default: TRUE) whether to execute SQL statement

Value

nothing

Examples

if (FALSE) { # \dontrun{
con <- cc_db_connect()
create_index(con, "ctd_casts", "geom", is_geom=T)
create_index(con, "ctd_casts", "cast_count", is_unique=T)
} # }