Tables and Views

Kasim Ali
2 min readJan 4, 2023

In this post, we will take a look at tables and views, managed and unmanaged tables as well as global and temporary operations.

Tables and Views | Kasim Data

Here are some things you need to know:

  • A table creates a table in an existing database.
  • A view is a SQL query stored in a database.
  • When you create a table you are writing to a database.
  • A global view or table is available across all clusters.
  • A temporary view or table is available only in the notebook you’re working in.

Temporary VS. Global View.

Temporary and global views have differences in speed times.

A simple SELECT query took over 12 seconds in our temporary view.

It also took just over 1 second to create the temporary view.

However, your global view will take a lot longer to create the table and a lot less time to query it.

So, depending on your use case. You might want to consider using a global view or temporary view.

Managed VS. Unmanaged Tables.

Managed tables are tables that manage both the data and metadata. In this case, a DROP TABLE command would remove the metadata for the table and the data itself.

Unmanaged tables manage the metadata from a table such as a schema and data location, but the data itself sits in a different location which is often backed by a blob store like the Azure Blob or S3. Dropping an unmanaged table drops only the metadata associated with the table while the data itself remains in place.

You will be able to see what type of table you are working with my running the following command:

DESCRIBE EXTENDED 'tableNameGoesHere'

Which will produce the following:

You learned about the differences between managed and unmanaged tables and global and temporary views.

Do let me know what you think of this post. I am still a learner myself and I would love to hear your thoughts. You are more than welcome to message me on LinkedIn or Twitter.

--

--