Learn R Programming

Andromeda (version 0.6.7)

createIndex: 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)

Value

Invisibly returns the input table.

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.

See Also

listIndices(), removeIndex()

Examples

Run this code
andr <- andromeda(cars = cars)

createIndex(andr$cars, "speed")

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

close(andr)

Run the code above in your browser using DataLab