There are two types of “tables” you can create in Interana: an event table and a Lookup table. Generally, Interana recommends storing all of your event data in a single event table (which is different than a relational database model). However, we support Lookup tables, where your primary event table can refer to a separate Lookup table to do static Lookups of names and details based on a field in the primary event table.
You can create a Lookup table that contains information that you’re not collecting with your event data but that you want to associate with the shard key.
Lookup tables are analogous to Left Joins in SQL. Because you’re associating static data in the Lookup table with active data (the event data you’re collecting) in your event table, Lookup tables are useful for data that does not change frequently. For example, date of birth, product ID, or ISBN.
For example, let’s say you have a primary event table with a "userId" column. You may have information about your users that isn’t collected as part of the event data. For example, when a user creates an account, you ask them for their name,birthday, and email address. This information isn’t part of the event data, but you want to be able to query on it.
What happens if the user gets a new email address? You can update the Lookup table value to have the user’s latest email address, and because Lookup tables are joined to event data at read time, all event data queries that reference userId.email_address will instantly display the updated email address.
You can join a Lookup table containing "userId," “name,” and "birthday" where there is a one-to-one mapping between the "userId" values in the primary event table and the new Lookup table. Then Interana will show you a list of fields like “userId.name” and "userId.birthday" that you can use in your queries.
Accessing Lookup Table Data in the User Interface
If you create a Lookup table with columns “id” and “email” and attach it to an event data table based on the column “user”, the user interface will show a new set of virtual columns: “user.id” and “user.email”. These virtual columns can be referenced just like regular columns.
You cannot query Lookup table directly from the Interana application (for example, you cannot select a Lookup table from the “tables” dropdown). You can only access this data as a read-time join to an event data query.
Storage options for Lookup tables
You can store the Lookup data itself as either sharded (spread across data nodes to save space) or unsharded (copied fully onto every data node). The sharded storage mode is more efficient in terms of disk space used, but there are some restrictions about building queries that use sharded Lookup tables.
If you store the Lookup table as a sharded table, then the data must be joined to one of the shard keys, or actor fields, in your event dataset. Because of this, you need to reference that shard key when running a query that references any columns in the Lookup table.
For example, let’s say you have two shard keys in your dataset: userId and OrganizationId. If you join your Lookup table to userId, then all queries that reference columns in that Lookup table must use the userId shard key. You can’t run any queries that use the OrganizationId shard key, since Interana doesn’t support querying on more than one shard key.
If you store the Lookup table as unsharded data, a copy of the Lookup table must be copied to every data node. However, you can join the Lookup table to any column in your data (the column doesn’t need to be a shard key) and you can reference any of the Lookup table columns in a query without using a specific shard key.
Use this table as a reference:
|Sharded Lookup table||Unsharded Lookup table|
|Can it be joined on a shard key?||Yes||Yes|
|Can it be joined on a non-shard key?||No||Yes|
If you need to join a Lookup table to a column that is not a shard key, then you must create a unsharded Lookup table. For example, if your dataset uses userId as a shard key, but you want to include more information about the products your users are buying (such as manufacturer, unit cost, model numbers) that isn’t logged with event data, but you don’t have a productId shard key. In this case, you can create an unsharded Lookup table and join it to an non-shard key column in your dataset, and reference those columns (manufacturer, unitCost, modelNum) in your queries.
We do not support “sharing” a single Lookup table with multiple event tables. You must join a Lookup table to exactly one event table.
Limitations and costs of unsharded Lookup tables
Creating an unsharded Lookup table offers more options in creating queries, but there are tradeoffs to that flexibility.
For unsharded Lookup tables, you must have a complete copy of the table on each data server. Because Lookup tables are stored in memory, we support the unsharded option for Lookup tables with up to 10 million rows. Tables larger than that must be sharded due to memory requirements. So unsharded tables give you more flexibility in terms of queries that you can create, but come with greater resource requirements.
Ingesting additional data
Once you’ve created Lookup tables, you can import data via the standard Interana pipeline service. There are two main reasons to import new data:
- Update existing data (for example, changing a manufacturer ID or SKU)
- Add new data (adding Lookup table data for new actors)
You only need to provide us with the changed (or new) data; you do not need to provide the entire Lookup table (although you can!). So if you’re adding data to account for new users (and the existing data is remaining the same), just send us the new data to ingest.
Interana updates Lookup tables on a row-by-row basis. In addition, if a user starts a query during the update process, the update will stop and wait until the query is finished. When querying while a Lookup table is being updated, the Lookup data may be in an inconsistent state, where only some of rows have been updated.
Updating and overwriting Lookup table information
Lookup tables have no sense of time. Lookup tables can only have one entry per primary key and updating the information will overwrite existing data. The most recently imported value will always take precedence.If you overwrite existing data in a Lookup table column, those values will be returned for all queries that reference that column, even if the query is for a data prior to when you updated the Lookup table.
For example, userId 104234 updates their mailing address from San Francisco to New York City.
|Previous row||104324||San Francisco|
|Updated row||104324||New York City|
The most recently imported value (New York City) will overwrite the previous value (San Francisco). If you query data for userId.mailingcity, you will get “New York City,” even if your query includes a time before the row was updated.
Lookup tables and null values
When updating a row of an existing Lookup table, you cannot reset a non-null value back to null. So if your Lookup table has a row like:
You cannot update the Zoo value to be an empty null (if Interana sees a null value, it will not update the entry). Instead, you can use a literal null value like NULL and set the value to: