Search Postgresql Archives

Query plan regression between CTE and views

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a query that was originally written as a handful of CTEs out of
convenience. It is producing a reasonable query plan because the CTE
materialization was kicking in at an appropriate place. The CTEs
aren't totally linear. The graph looks like this, where A, B, C and D
are CTEs, and B -> A means B selects from A. In Graphviz format:

G {
   B -> A;
   C -> A;
   C -> B;
   D -> C;
}

Out of curiosity I tried turning the query into a series of views and
ran that query. The query plan is vastly different, there is no
materialization and it runs much slower.

My question is: is this a valid bug? I am not sure if I should expect
the view version to find a way to materialize and produce a comparable
query plan. Also, making a minimal test case is going to take a bit
and I don't want to start unless this smells like a genuine bug.

-- 
David Gilman
:DG<





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux