How can I speed up my LIMIT 0 queries?
See all drill best practice FAQs.
One question we in the Drill team are frequently asked is how to speed up LIMIT 0 queries.
Because Drill is schema-less, it needs to discover schema “on the fly” through partial execution of the query. You can speed up this discovery by providing “hints”. Explicitly specify the types of columns in your query by explicitly casting them. The easiest way to do this is to create views where you specify the casting, and then to query from the views rather than the base tables.
CREATE VIEW dfs.v AS SELECT CAST(intCol AS INTEGER), CAST(varcharCol AS VARCHAR(10)) FROM dfs.tab;
SELECT * FROM dfs.v;
Note that this is not necessary in the case of Hive tables, where Drill does have column types available through the Hive metastore.
Retrieving data ...