This is a diff between 1.2 and 1.3 revisions:

* [[http://docs.openlinksw.com/virtuoso/rdfsparql.html][Virtuoso Documentation]] * [[VirtTipsAndTricksGuide][Virtuoso Tips and Tricks Collection]]---++RelatedSQL> SET EXPLAIN OFF;
>/verbatim>
13 Rows. -- 1 msec.}Select (TOP 10 ) ($25 "s", $26 "o", <$24 "<DB.DBA.RDF_QUAD s_1_0-t0>" spec 5>) 10: BReturn 0 5: $26 "o" := Call __ro2sq ($21 "s_1_0-t0.O")2d0After code: row specs: <col=554 G = #http://dbpedia.org > inlined <col=556 P = #type >Key RDF_QUAD_POGS ASC ($22 "s_1_0-t0.S", $21 "s_1_0-t0.O")from DB.DBA.RDF_QUAD by RDF_QUAD_POGS 4.5e+05 rows { _______________________________________________________________________________VARCHARREPORT; OPTION (QUIETCAST) AND "s_1_0-t0"."P" = __i2idn ( __bft( 'http://www.w3.org/1999/02/22-rdf-syn tax-ns#type' , 1)) WHERE "s_1_0-t0"."G" = __i2idn ( __bft( 'http://dbpedia.org' , 1)) FROM DB.DBA.RDF_QUAD AS "s_1_0-t0"2d0SQL> SET EXPLAIN ON;command. Then hit the ENTER key.
>verbatim>
1. Use your mouse to select the query output, and paste it after the <code>SET EXPLAIN ON;</code> SQL> SET SPARQL_TRANSLATE OFF;
>/verbatim>
1 Rows. -- 1 msec.OPTION (QUIETCAST) AND "s_1_0-t0"."P" = __i2idn ( __bft( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))WHERE "s_1_0-t0"."G" = __i2idn ( __bft( 'http://dbpedia.org' , 1))FROM DB.DBA.RDF_QUAD AS "s_1_0-t0" __ro2sq ( "s_1_0-t0"."O" ) AS "o"2d0_______________________________________________________________________________VARCHARSPARQL_TO_SQL_TEXTSQL> SELECT * FROM <http://dbpedia.org> WHERE {?s a ?o} LIMIT 10;SQL> SET SPARQL_TRANSLATE ON; -- in case output is very largeSQL> SET BLOBS ON; 1. Use the <code>isql</code> command line tool to connect to your database, and execute:
>verbatim>
LIMIT 10
>/verbatim>
} ?s a ?o {WHERE FROM <http://dbpedia.org> SELECT * 1 Assume the following query:
>verbatim>
Here is a simple example of how to combine the two options to get a full <code>explain()</code> plan for a simple SPARQL query: Provide the generated plans for analysis.SQL> SET PROFILE OFF;
>/verbatim>
---> Or execute query of your choiceSQL> SELECT * FROM TABLE WHERE field = 'text';SQL> SET BLOBS ON;SQL> SET PROFILE ON;SQL> __dbf_set('dbf_explain_level', 3);SQL> __dbf_set('enable_qr_comment', 1); 1 A more detailed query profile (compilation and execution) with cardinality can be obtained by executing the following following sequence
>verbatim>
SQL> profile('select * from table where field = ''text''');
>/verbatim>
* The equivalent (available in Virtuoso 7 and later) is <code>[[http://docs.openlinksw.com/virtuoso/fn_profile/][PROFILE()]]</code>, which is much more difficult to use; you cannot just copy-and-paste a query, as all quotes must be doubled within t
>verbatim>
SQL> SET PROFILE OFF;
>/verbatim>
---> Or execute query of your choiceSQL> SELECT * FROM TABLE WHERE field = 'text';SQL> SET PROFILE ON; 1 Generate compilation and execution plan of an SQL query:
>verbatim>
SQL> explain('select * from table where field = ''text''');
>/verbatim>
* The equivalent is <code>[[http://docs.openlinksw.com/virtuoso/fn_explain/][EXPLAIN()]]</code>, which is much more difficult to use; you cannot just copy-and-paste a query, as all quotes must be doubled within the <code>EXPLAIN(' ... ')</code>, as
>verbatim>
SQL> SET EXPLAIN OFF;
>/verbatim>
---> Or execute query of your choiceSQL> SELECT * FROM TABLE WHERE field = 'text';SQL> SET EXPLAIN ON; 1 Generate compilation plan of an SQL query:
>verbatim>
SQL> SET SPARQL_TRANSLATE OFF;
>/verbatim>
---> Or execute query of your choiceSQL> SELECT * FROM <graph> WHERE {?S a ?O};SQL> SET SPARQL_TRANSLATE ON; 1 Translate a SPARQL query into the correspondent SQL:
>verbatim>
Starting with Virtuoso Commercial Release 6.4, and Virtuoso Open Source 6.1.5, <code>isql</code> offers 2 new modes for analyzing SPARQL queries: ---+ How can I get a full explain and profile plans for a simple SPARQL query?%META:TOPICPARENT{name="VirtTipsAndTricksGuide"}%