createIndex {Andromeda}R Documentation

Create an index on one or more columns in an Andromeda table

Description

Create an index on one or more columns in an Andromeda table

Usage

createIndex(tbl, columnNames, unique = FALSE, indexName = NULL)

Arguments

tbl

An Andromeda table (or any other 'DBI' table).

columnNames

A vector of column names (character) on which the index is to be created.

unique

Should values in the column(s) be enforced to be unique?

indexName

The name of the index. If not provided, a random name will be generated.

Details

Indices can speed up subsequent queries that use the indexed columns, but can take time to create, and will take additional space on the drive.

Value

Invisibly returns the input table.

See Also

listIndices(), removeIndex()

Examples

andr <- andromeda(cars = cars)

createIndex(andr$cars, "speed")

# Will be faster now that speed is indexed:
andr$cars %>%
  filter(speed == 10) %>%
  collect()

close(andr)


[Package Andromeda version 0.4.1 Index]