Create index in database

create_index(
  con,
  tbl,
  flds,
  geom = F,
  unique = F,
  overwrite = F,
  show = F,
  exec = T
)

Arguments

con

database connection from DBI::dbConnect(), eg from am_pg_con()

tbl

table name as character

flds

character vector of fields in table used for index

geom

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

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) {
con <- am_pg_con()
create_index(con, "am_cell_blocks", "geom", geom=T)
create_index(con, "am_cell_blocks", "zcb_id")
}