<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: When querying a VIEW, query planning takes a long time in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50209#M15202</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13477"&gt;@Lars Volker&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I have a question for you.&lt;/P&gt;&lt;P&gt;Does VIEW still need to load metadata separately even if&amp;nbsp;metadata of TABLE for VIEW is already loaded?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;which CDH/Impala are you using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Gatsby&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 23:46:43 GMT</pubDate>
    <dc:creator>thewayofthinkin</dc:creator>
    <dc:date>2017-01-31T23:46:43Z</dc:date>
    <item>
      <title>When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50171#M15200</link>
      <description>&lt;P&gt;Hello -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first time - CREATE VIEW table_view AS SELECT * from table_0130&lt;/P&gt;&lt;P&gt;daily - ALTER VIEW table_view AS SELECT * from table_0131&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On further digging into query profile, I found that the query planning is taking 2+ mins.&amp;nbsp;Why would it take so much time? The VIEW is a simple one, just a SELECT *. Any impala conf settings that can resolve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help, pointers regarding this issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Querying VIEW&lt;/P&gt;&lt;PRE&gt;    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)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Querying TABLE (directly)&lt;/P&gt;&lt;PRE&gt;    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)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:59:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50171#M15200</guid>
      <dc:creator>gaurang</dc:creator>
      <dc:date>2022-09-16T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50204#M15201</link>
      <description>&lt;P&gt;Hi gaurang,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers, Lars&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:37:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50204#M15201</guid>
      <dc:creator>Lars Volker</dc:creator>
      <dc:date>2017-01-31T20:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50209#M15202</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13477"&gt;@Lars Volker&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I have a question for you.&lt;/P&gt;&lt;P&gt;Does VIEW still need to load metadata separately even if&amp;nbsp;metadata of TABLE for VIEW is already loaded?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;which CDH/Impala are you using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Gatsby&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 23:46:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50209#M15202</guid>
      <dc:creator>thewayofthinkin</dc:creator>
      <dc:date>2017-01-31T23:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50213#M15203</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13862"&gt;@thewayofthinkin&lt;/a&gt;&amp;nbsp;- 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.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:01:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50213#M15203</guid>
      <dc:creator>Lars Volker</dc:creator>
      <dc:date>2017-02-01T00:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50214#M15204</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13477"&gt;@Lars Volker&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that way too.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for confirming it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gatsby&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:12:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50214#M15204</guid>
      <dc:creator>thewayofthinkin</dc:creator>
      <dc:date>2017-02-01T00:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50222#M15205</link>
      <description>&lt;P&gt;Hi Lars-&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gaurang&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 01:38:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50222#M15205</guid>
      <dc:creator>gaurang</dc:creator>
      <dc:date>2017-02-01T01:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50223#M15206</link>
      <description>&lt;P&gt;Hi guarang,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you post the version of CDH and Impala you're using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, Lars&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 01:40:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50223#M15206</guid>
      <dc:creator>Lars Volker</dc:creator>
      <dc:date>2017-02-01T01:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50224#M15207</link>
      <description>Hey Gatsby - I'm using impalad version 2.3.0-cdh5.5.1</description>
      <pubDate>Wed, 01 Feb 2017 01:42:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50224#M15207</guid>
      <dc:creator>gaurang</dc:creator>
      <dc:date>2017-02-01T01:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50265#M15208</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13477"&gt;@Lars Volker&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question for you.&lt;/P&gt;&lt;P&gt;How long the metadata loaded from Hive metastore by Impala Catalog Daemon stay in memory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Impala 2.7 ( KUDU ).&lt;/P&gt;&lt;P&gt;It seems the metadata is flushed more often than before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any configuration for life cycle for metadata in catalog daemon has?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I'm asking this question here because I guess&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13477"&gt;@Lars Volker&lt;/a&gt;&amp;nbsp;answer can help resolve your issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Gatsby&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 20:44:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50265#M15208</guid>
      <dc:creator>thewayofthinkin</dc:creator>
      <dc:date>2017-02-01T20:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50268#M15209</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today, I had some issue with slow quries.&lt;/P&gt;&lt;P&gt;And, the issue was related to metadata Catalog Daemon caches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How often do you make quries to that TABLE/VIEW ( I don't think your issue is related to VIEW )?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case, metadata for TABLE was reloaded very often because Catalog Daemon flushes out metadata.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Take a look your catalog daemon and check if TABLE metadata is cached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gatsby&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 22:09:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50268#M15209</guid>
      <dc:creator>thewayofthinkin</dc:creator>
      <dc:date>2017-02-01T22:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50291#M15210</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt;&amp;nbsp;- I suspect you may be hitting&amp;nbsp;&lt;A href="https://issues.cloudera.org/browse/IMPALA-4242" target="_self"&gt;IMPALA-4242&lt;/A&gt;. Can you reduce the number of columns you're querying?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 14:00:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50291#M15210</guid>
      <dc:creator>Lars Volker</dc:creator>
      <dc:date>2017-02-02T14:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50292#M15211</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13862"&gt;@thewayofthinkin&lt;/a&gt;&amp;nbsp;- I don't know for sure, but I don't think metadata is flushed periodically. There also don't seem to be any configuration options of catalogd around metadata caching. Instead, the catalog should flush metadata when requested by "invalidate metadata" or by "refresh" or when a DDL statement makes changes to a table's metadata. Such changes should show up in the logfiles however.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 14:02:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50292#M15211</guid>
      <dc:creator>Lars Volker</dc:creator>
      <dc:date>2017-02-02T14:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50308#M15212</link>
      <description>yeap. you're right. I will take a look log.&lt;BR /&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;Gatsby</description>
      <pubDate>Thu, 02 Feb 2017 17:26:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50308#M15212</guid>
      <dc:creator>thewayofthinkin</dc:creator>
      <dc:date>2017-02-02T17:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50319#M15213</link>
      <description>Hey Iv@c - I think you are right. The table beneath has 700+ columns. The moment I created a VIEW selecting just 30 columns, the response time became same as what I get querying directly the table (2-3 secs).&lt;BR /&gt;In my case though, I cannot select a set of columns, because the VIEW needs to be queries across the application. Maybe when we get a chance to change the front-end queries, we will try to implement this. Create different views for different reports, selecting just required columns from the underlying table.</description>
      <pubDate>Thu, 02 Feb 2017 19:27:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50319#M15213</guid>
      <dc:creator>gaurang</dc:creator>
      <dc:date>2017-02-02T19:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: When querying a VIEW, query planning takes a long time</title>
      <link>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50333#M15214</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/13677"&gt;@gaurang&lt;/a&gt; would you be open to sharing your CREATE TABLEs, CREATE VIEW and the query that has slow planning time? No need for the data, just that should be sufficient for us to understand better what's going on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like Lars said, you are probably hitting&amp;nbsp;IMPALA-4242 which explains the slow equivalence class computation, but I'd also like to understand the slow single-node planning time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2017 06:07:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/When-querying-a-VIEW-query-planning-takes-a-long-time/m-p/50333#M15214</guid>
      <dc:creator>alex.behm</dc:creator>
      <dc:date>2017-02-03T06:07:39Z</dc:date>
    </item>
  </channel>
</rss>

