As we are recomputing data everyday, I need remove old data and load new data everyday. We create our parquet data files through Map Reduce. So in order to reach ZERO downtime during switching yesterday's data with today's data, I came up with the idea of having a fixed VIEW and then after batch processing issue a ALTER VIEW statement to change the underlying table.
first time - CREATE VIEW table_view AS SELECT * from table_0130
daily - ALTER VIEW table_view AS SELECT * from table_0131
Most of our queries worked well. The response time did degrade slightly but nothing alarming. But for few BIG JOIN queries, the response time went from 2-3 secs to 2-3 mins.
On further digging into query profile, I found that the query planning is taking 2+ mins. Why would it take so much time? The VIEW is a simple one, just a SELECT *. Any impala conf settings that can resolve this?
I appreciate any help, pointers regarding this issue.
Planner Timeline: 2m17s - Analysis finished: 2s588ms (2s588ms) - Equivalence classes computed: 1m16s (1m13s) - Single node plan created: 2m17s (1m1s) - Distributed plan created: 2m17s (223.64ms) - Lineage info computed: 2m17s (2.6ms) - Planning finished: 2m17s (9.974ms) Query Timeline: 2m31s - Start execution: 53.597us (53.597us) - Planning finished: 2m26s (2m26s) - Ready to start remote fragments: 2m26s (63.364ms) - Remote fragments started: 2m31s (4s442ms) - Cancelled: 2m31s (5.567ms) - Rows available: 2m31s (35.971ms) - Unregister query: 2m31s (118.833us)
Querying TABLE (directly)
Planner Timeline: 55.334ms - Analysis finished: 21.430ms (21.430ms) - Equivalence classes computed: 22.938ms (1.507ms) - Single node plan created: 47.813ms (24.875ms) - Distributed plan created: 51.913ms (4.99ms) - Lineage info computed: 52.394ms (481.757us) - Planning finished: 55.334ms (2.939ms) Query Timeline: 1s036ms - Start execution: 45.736us (45.736us) - Planning finished: 125.378ms (125.332ms) - Ready to start remote fragments: 129.281ms (3.902ms) - Remote fragments started: 478.56ms (348.775ms) - Rows available: 882.741ms (404.685ms) - First row fetched: 982.468ms (99.727ms) - Unregister query: 998.825ms (16.356ms)
Does the long query time only occur the first time you query a view after altering it? In that case if could be related to metadata loading for the underlying table. How many partitions and files do these tables typically have? You could also check the log files for anything suspicious.
@thewayofthinkin - No, the view should get expanded and then the resulting query will access the already loaded metadata of the table. From the order of the queries it looked like the view may be queried first, then the table, which could explain why the former took much longer than the latter.
No. Everytime I fire the query, it takes this long. I haven't checked logs yet. Went through the query profile, and found that query planning is what killing me. Will check logs to see if I can find anything.
Thanks for your response.