From c82fe4781cd0356bcfdd25c7eadf1da624bb2228 Mon Sep 17 00:00:00 2001 From: CrazyJvm <crazyjvm@gmail.com> Date: Fri, 1 Aug 2014 11:46:13 -0700 Subject: [PATCH] [SQL] Documentation: Explain cacheTable command add the `cacheTable` specification Author: CrazyJvm <crazyjvm@gmail.com> Closes #1681 from CrazyJvm/sql-programming-guide-cache and squashes the following commits: 0a231e0 [CrazyJvm] grammar fixes a04020e [CrazyJvm] modify title to Cached tables 18b6594 [CrazyJvm] fix format 2cbbf58 [CrazyJvm] add cacheTable guide --- docs/sql-programming-guide.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/sql-programming-guide.md b/docs/sql-programming-guide.md index a047d32b6e..7261badd41 100644 --- a/docs/sql-programming-guide.md +++ b/docs/sql-programming-guide.md @@ -769,3 +769,13 @@ To start the Spark SQL CLI, run the following in the Spark directory: Configuration of Hive is done by placing your `hive-site.xml` file in `conf/`. You may run `./bin/spark-sql --help` for a complete list of all available options. + +# Cached tables + +Spark SQL can cache tables using an in-memory columnar format by calling `cacheTable("tableName")`. +Then Spark SQL will scan only required columns and will automatically tune compression to minimize +memory usage and GC pressure. You can call `uncacheTable("tableName")` to remove the table from memory. + +Note that if you just call `cache` rather than `cacheTable`, tables will _not_ be cached in +in-memory columnar format. So we strongly recommend using `cacheTable` whenever you want to +cache tables. -- GitLab