Re: [MonetDB-users] Query plans
Anthony, Suppose you installed MonetDB in the default directory, and have a directory c:\tmp with in it xquery c:\tmp\q.xq, then open a dos box and type (ignoring the prompt>): prompt> cd c:\Program Files\CWI\MonetDB4\bin prompt> set PATH=%PATH%;c:\Program Files\CWI\MonetDB4\lib\ prompt> pf c:\tmp\q.xq The plan you now see on your screen is a low-level physical binary table algebra (MIL) plan. This is what MonetDB executes in the end. The "pf" command is a standalone tool that invokes the "pathfinder" xquery compiler (www.pathfinder-xquery.org), that is integrated in MonetDB/XQuery. It provides many options (see: pf -H). Alternative things to try if you want to undertand query plans: prompt> pf -cPs15 c:\tmp\q.xq prompt> pf -lDs18 c:\tmp\q.xq prompt> pf -pDs20 c:\tmp\q.xq The first one prints the "XQuery Core" representation. At that stage, the query is still formulated in xQuery, but minimized to the subset defined in the XQuery Formal Semantics spec by W3C. The second one produces a logical relational algebra query plan, the third the physical relational algebra plan. Both are a more classical relational algebra (in the database textbook sense), these are intermediate stages the query goes through in the pathfinder. To understand these better, you would probably need to read some papers on MonetDB/XQuery and pathfinder (see the publication library). The last two commands produce output in the "dot" format, you can visualize these with dotty.exe. To do so, download and install the graphviz package (http://www.graphviz.org/Download.php) and make sure the location of "dotty.exe" is in your PATH. Then the following works: prompt> pf -pDs20 c:\tmp\q.xq > c:\tmp\ prompt> dotty c:\tmp\q.dotty (you can resize the screen, and use the menu under the right mouse buttom to zoom in) Peter PS Even though MonetDB/XQuery does not use it, you can even translate xqueries to SQL (to be executed on DB2 only, it does not work on MonetDB/SQL or other systems AFAIK): prompt> pf -Sc:\tmp\q.xq From: Anthony Gkountintas [mailto:agkount@hotmail.com] Sent: Monday, May 25, 2009 10:55 AM To: monet Subject: Query plans Hi all, Is there a possibility to view the xquery execution plans in MonetDb? I am running XQueries on windows platform. thanks Tony ________________________________________ Share your photos with Windows Live Photos – Free. Try it Now! Internal Virus Database is out of date. Checked by AVG - www.avg.com Version: 8.5.238 / Virus Database: 270.12.23/2106 - Release Date: 05/09/09 06:54:00
Peter Boncz wrote:
Anthony,
Suppose you installed MonetDB in the default directory, and have a directory c:\tmp with in it xquery c:\tmp\q.xq, then
open a dos box and type (ignoring the prompt>): prompt> cd c:\Program Files\CWI\MonetDB4\bin prompt> set PATH=%PATH%;c:\Program Files\CWI\MonetDB4\lib\ prompt> pf c:\tmp\q.xq
There is no need to change the PATH. You can use "C:\Program Files\MonetDB\MonetDB4\pf.bat" instead of the pf.exe in the bin subdirectory. Also note that we don't use the CWI folder anymore: it's called MonetDB now.
The plan you now see on your screen is a low-level physical binary table algebra (MIL) plan. This is what MonetDB executes in the end.
The "pf" command is a standalone tool that invokes the "pathfinder" xquery compiler (www.pathfinder-xquery.org), that is integrated in MonetDB/XQuery. It provides many options (see: pf -H).
Alternative things to try if you want to undertand query plans: prompt> pf -cPs15 c:\tmp\q.xq prompt> pf -lDs18 c:\tmp\q.xq prompt> pf -pDs20 c:\tmp\q.xq
The first one prints the "XQuery Core" representation. At that stage, the query is still formulated in xQuery, but minimized to the subset defined in the XQuery Formal Semantics spec by W3C. The second one produces a logical relational algebra query plan, the third the physical relational algebra plan. Both are a more classical relational algebra (in the database textbook sense), these are intermediate stages the query goes through in the pathfinder. To understand these better, you would probably need to read some papers on MonetDB/XQuery and pathfinder (see the publication library).
The last two commands produce output in the "dot" format, you can visualize these with dotty.exe. To do so, download and install the graphviz package (http://www.graphviz.org/Download.php) and make sure the location of "dotty.exe" is in your PATH.
Then the following works: prompt> pf -pDs20 c:\tmp\q.xq > c:\tmp\ prompt> dotty c:\tmp\q.dotty
(you can resize the screen, and use the menu under the right mouse buttom to zoom in)
Peter
PS Even though MonetDB/XQuery does not use it, you can even translate xqueries to SQL (to be executed on DB2 only, it does not work on MonetDB/SQL or other systems AFAIK): prompt> pf -Sc:\tmp\q.xq
From: Anthony Gkountintas [mailto:agkount@hotmail.com] Sent: Monday, May 25, 2009 10:55 AM To: monet Subject: Query plans
Hi all,
Is there a possibility to view the xquery execution plans in MonetDb? I am running XQueries on windows platform.
thanks
Tony ________________________________________ Share your photos with Windows Live Photos – Free. Try it Now! Internal Virus Database is out of date. Checked by AVG - www.avg.com Version: 8.5.238 / Virus Database: 270.12.23/2106 - Release Date: 05/09/09 06:54:00
------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender
participants (2)
-
Peter Boncz
-
Sjoerd Mullender