{"id":2375,"date":"2019-02-21T13:16:57","date_gmt":"2019-02-21T13:16:57","guid":{"rendered":"https:\/\/nenadnoveljic.com\/blog\/?p=2375"},"modified":"2019-02-21T13:17:00","modified_gmt":"2019-02-21T13:17:00","slug":"correlated-subqueries-in-the-select-clause","status":"publish","type":"post","link":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/","title":{"rendered":"Correlated Subqueries in the SELECT Clause"},"content":{"rendered":"<p>In this blog post, I&#8217;ll be analyzing how Oracle 18c and SQL Server 2017 optimize queries with a correlated subquery in the SELECT clause, such as the following:<\/p>\n<pre><code><span style=\"color:blue\">select<\/span> \/*+ qb_name(QB_MAIN) *\/ \n  case when <span style=\"color:blue\">exists<\/span> ( \n    select \/*+ qb_name(QB_EXISTS) *\/ 1 \n\t  from t_1k \n\t  where t_1k.n1 = t_100k.n1 \n  ) then 1 else 0 end\n  from t_100k ;<\/code><\/pre>\n<p>First, we&#8217;re going to explore the limitations of the Oracle optimizer.<\/p>\n<h1>Oracle<\/h1>\n<h2>Tables<\/h2>\n<p>The tables t_1k and t_100k are created as follows:<\/p>\n<pre><code>create table t_1k ( n1 integer ) ;\n\ncreate table t_100k ( n1 integer ) ;\n\ninsert into t_1k\n  select level\n    from dual\n    connect by level &lt;= 1000;\n\ninsert into t_100k\n  select level \n    from dual\n    connect by level &lt;= 100000;\n    \ncommit ;\n\nbegin\n  dbms_stats.gather_table_stats ( null, 'T_1K') ;\n  dbms_stats.gather_table_stats ( null, 'T_100K') ;\nend ;\n\/<\/code><\/pre>\n<p>The larger table t_100k is used in the main query block, the smaller t_1k in the subquery.<\/p>\n<h2>Missing Join<\/h2>\n<p>What first strikes out is that there isn&#8217;t any join operation performed.<\/p>\n<pre><code>-----------------------------------------------------------------------------\n| Id  | Operation         | Name   | E-Rows |E-Bytes| Cost (%CPU)| E-Time   |\n-----------------------------------------------------------------------------\n|   0 | SELECT STATEMENT  |        |        |       |   <span style=\"color:red\">356K<\/span>(100)|          |\n|*  1 |  TABLE ACCESS FULL| T_1K   |      1 |     4 |     4   (0)| 00:00:01 |\n|   2 |  TABLE ACCESS FULL| T_100K |    100K|   488K|    33   (0)| 00:00:01 |\n-----------------------------------------------------------------------------<\/code><\/pre>\n<p>Therefore, it comes to no surprise that both query blocks are optimized independently (they&#8217;re marked as OUTLINE_LEAF in the outline section):<\/p>\n<pre><code>Query Block Name \/ Object Alias (identified by operation id):\n-------------------------------------------------------------\n \n   1 - QB_EXISTS \/ T_1K@QB_EXISTS\n   2 - QB_MAIN   \/ T_100K@QB_MAIN\n \nOutline Data\n-------------\n \n  \/*+\n      BEGIN_OUTLINE_DATA\n      IGNORE_OPTIM_EMBEDDED_HINTS\n      OPTIMIZER_FEATURES_ENABLE('18.1.0')\n      DB_VERSION('18.1.0')\n      ALL_ROWS\n      <span style=\"color:blue\">OUTLINE_LEAF(@\"QB_EXISTS\")\n      OUTLINE_LEAF(@\"QB_MAIN\")<\/span>\n      FULL(@\"QB_MAIN\" \"T_100K\"@\"QB_MAIN\")\n      FULL(@\"QB_EXISTS\" \"T_1K\"@\"QB_EXISTS\")\n      END_OUTLINE_DATA\n  *\/<\/code><\/pre>\n<p>Finally, the predicate and column projection sections tell us that the driving table is T_100K.<\/p>\n<pre><code>Predicate Information (identified by operation id):\n---------------------------------------------------\n \n   1 - filter(\"T_1K\".\"N1\"=:B1)\n \nColumn Projection Information (identified by operation id):\n-----------------------------------------------------------\n \n   2 - \"T_100K\".\"N1\"[NUMBER,22]<\/code><\/pre>\n<p>So, T_1K.N1 is matched for every single retrieved row from T_100K. That&#8217;s the reason why the number of rows in the driving row source will be the main contributor to the total cost, specially for large driving row sources:<br \/>\ntotal_cost ~ driving_row_source_cost + k * driving_rows * single_subquery_access_cost<br \/>\n<span style=\"color:red\">356000<\/span> ~ 33 + k * <span style=\"color:red\">100000<\/span> * 4<\/p>\n<p>By the way, k is around 0.5 for smaller tables and then it grows toward 1 with the table size. That&#8217;s presumably to factor in the caching effect.<\/p>\n<p>Anyway, the query will perform poorly for large driving row sources &#8211; the query indeed executed <span style=\"color:red\">500323<\/span> logical reads.<\/p>\n<p>Further, it can be easily seen that our example query isn&#8217;t an exception, but rather other correlated subqueries suffer from the same problem too, like, for example:<\/p>\n<pre><code>select \/*+ qb_name(QB_MAIN) *\/  \n  (\n    select \/*+ qb_name(QB_EXISTS) *\/ n1 \n\t  from t_1k \n\t  where t_1k.n1 = t_100k.n1 \n  ) \n  from t_100k ;\n  \n----------------------------------------------------------------------------\n| Id  | Operation         | Name   | Rows  | Bytes | Cost (%CPU)| Time     |\n----------------------------------------------------------------------------\n|   0 | SELECT STATEMENT  |        |   100K|   488K|   <span style=\"color:red\">371K<\/span>  (1)| 00:00:59 |\n|*  1 |  TABLE ACCESS FULL| T_1K   |     1 |     4 |     4   (0)| 00:00:01 |\n|   2 |  TABLE ACCESS FULL| T_100K |   100K|   488K|    33   (0)| 00:00:01 |\n----------------------------------------------------------------------------\n\nPredicate Information (identified by operation id):\n---------------------------------------------------\n \n   1 - filter(\"T_1K\".\"N1\"=:B1)<\/code><\/pre>\n<p>Notice that the first executed operation in the execution plan isn&#8217;t the first child, as per usual, but the second one.<\/p>\n<p>In conclusion, problematic correlated subqueries have a specific shape with the following characteristics:<\/p>\n<ul>\n<li>two children of the SELECT operation without a join,<\/li>\n<li>filter predicate on the first child,<\/li>\n<li>high cost of the parent SELECT related to a high cardinality of the second child.<\/li>\n<\/ul>\n<p>I recommend memorizing this pattern, because it can help you immediately identify a problematic correlated subquery even in larger execution plans where the subquery is buried under many layers of cascaded views.<\/p>\n<p>But, is there a better way to execute the same query?<\/p>\n<h2>Outer Join<\/h2>\n<p>The answer is yes, but we have to manually rewrite it to use a join. For instance, the query<\/p>\n<pre><code>select \/*+ qb_name(QB_MAIN) *\/ \n  case when exists ( \n    select \/*+ qb_name(QB_EXISTS) *\/ 1 \n\t  from t_1k \n\t  where t_1k.n1 = t_100k.n1 \n  ) then 1 else 0 end\n  from t_100k ;<\/code><\/pre>\n<p>can be rewritten as:<\/p>\n<pre><code>select  \n  case when v.n1 is not null then 1 else 0 end\n  from t_100k, ( select distinct n1 from t_1k ) v\n  where t_100k.n1 = v.n1(+) ;\n\n--------------------------------------------------------------------------------\n| Id  | Operation             | Name   | Rows  | Bytes | Cost (%CPU)| Time     |\n--------------------------------------------------------------------------------\n|   0 | SELECT STATEMENT      |        |   100K|  1757K|    <span style=\"color:green\">39<\/span>   (6)| 00:00:01 |\n|*  1 |  HASH JOIN RIGHT OUTER|        |   100K|  1757K|    39   (6)| 00:00:01 |\n|   2 |   VIEW                |        |  1000 | 13000 |     5  (20)| 00:00:01 |\n|   3 |    HASH UNIQUE        |        |  1000 |  4000 |     5  (20)| 00:00:01 |\n|   4 |     TABLE ACCESS FULL | T_1K   |  1000 |  4000 |     4   (0)| 00:00:01 |\n|   5 |   TABLE ACCESS FULL   | T_100K |   100K|   488K|    33   (0)| 00:00:01 |\n--------------------------------------------------------------------------------\n \nPredicate Information (identified by operation id):\n---------------------------------------------------\n \n   1 - access(\"T_100K\".\"N1\"=\"V\".\"N1\"(+))<\/code><\/pre>\n<p>As you can see, the plan has a significantly lower cost than the original, <span style=\"color:green\">39<\/span> and <span style=\"color:red\">371000<\/span>, respectively. The total cost entails retrieving both row sources and combining them together with a hash join.<\/p>\n<p>The modified query performed <span style=\"color:green\">161<\/span> logical reads, which is orders of magnitude less than carried out by the original query (<span style=\"color:green\">500323<\/span>).<\/p>\n<p>We&#8217;ve seen so far how the query can be rewritten to execute more efficiently. Now it&#8217;s time to check how SQL Server optimizes the same original query.<\/p>\n<h1>SQL Server<\/h1>\n<p>Below is the equivalent test case for SQL Server:<\/p>\n<pre><code>drop table t_1k ;\n\ndrop table t_100k ;\n\ncreate table t_1k (n1 integer) ;\n\ncreate table t_100k (n1 integer) ;\n\ninsert into t_1k \nSELECT TOP (1000) \n  n1 = CONVERT(INT, ROW_NUMBER() OVER (ORDER BY s1.[object_id]))\nFROM sys.all_objects AS s1 CROSS JOIN sys.all_objects AS s2\nOPTION (MAXDOP 1);\n\ninsert into t_100k\nSELECT TOP (100000) \n  n1 = CONVERT(INT, ROW_NUMBER() OVER (ORDER BY s1.[object_id]))\nFROM sys.all_objects AS s1 CROSS JOIN sys.all_objects AS s2\nOPTION (MAXDOP 1);\n\nset statistics io on \n\nselect \n  case when exists ( \n    select  1 \n\t  from t_1k \n\t  where t_1k.n1 = t_100k.n1 \n  ) then 1 else 0 end\n  from t_100k ; <\/code><\/pre>\n<p>That&#8217;s terrific! Unlike Oracle, SQL Server transformed the query to use merge semi join out of the box:<\/p>\n<pre><code>StmtText\tStmtId\tNodeId\tParent\tEstimateRows\tTotalSubtreeCost\tEstimateExecutions\n  |--Compute Scalar(DEFINE:([Expr1007]=CASE WHEN [Expr1008] THEN (1) ELSE (0) END))\t1\t2\t1\t90000\t<span style=\"color:green\">8.64109<\/span>\t1\n       |--<span style=\"color:green\">Merge Join<\/span>(Left Semi Join, MANY-TO-MANY MERGE:([DERITRADE].[dbo].[t_100k].[n1])=([DERITRADE].[dbo].[t_1k].[n1]), RESIDUAL:([DERITRADE].[dbo].[t_1k].[n1]=[DERITRADE].[dbo].[t_100k].[n1]))\t1\t3\t2\t90000\t8.632091\t1\n            |--Sort(ORDER BY:([DERITRADE].[dbo].[t_100k].[n1] ASC))\t1\t4\t3\t100000\t7.995876\t1\n            |    |--Table Scan(OBJECT:([DERITRADE].[dbo].[t_100k]))\t1\t5\t4\t100000\t0.3606894\t1\n            |--Sort(ORDER BY:([DERITRADE].[dbo].[t_1k].[n1] ASC))\t1\t6\t3\t1000\t0.03351212\t1\n                 |--Table Scan(OBJECT:([DERITRADE].[dbo].[t_1k]))\t1\t7\t6\t1000\t0.006604222\t1\n<\/code><\/pre>\n<p>The execution resulted in only <span style=\"color:green\">339<\/span> logical reads without having to manually rewrite the query:<\/p>\n<pre><code>(100000 rows affected)\nTable 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.\nTable 't_1k'. Scan count 1, logical reads <span style=\"color:green\">4<\/span>, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.\nTable 't_100k'. Scan count 1, logical reads <span style=\"color:green\">335<\/span>, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.<\/code><\/pre>\n<h1>Summary<\/h1>\n<ul>\n<li>Unfortunately, Oracle doesn&#8217;t optimally handle queries with correlated subqueries in the select clause.<\/li>\n<li>Such queries can be manually rewritten to use join instead.<\/li>\n<li>Suboptimal correlated subqueries have a specific shape that can be easily spotted in a larger execution plan.<\/li>\n<li>Unlike Oracle, SQL Server automatically transforms such queries to use more efficient joins.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle. <a href=\"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[21,11,5,17],"tags":[],"class_list":["post-2375","post","type-post","status-publish","format-standard","hentry","category-comparison-oracle-sql-server","category-cost-based-optimizer","category-oracle","category-sql-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Correlated Subqueries in the SELECT Clause - All-round Database Topics<\/title>\n<meta name=\"description\" content=\"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Correlated Subqueries in the SELECT Clause - All-round Database Topics\" \/>\n<meta property=\"og:description\" content=\"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/\" \/>\n<meta property=\"og:site_name\" content=\"All-round Database Topics\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-21T13:16:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-02-21T13:17:00+00:00\" \/>\n<meta name=\"author\" content=\"Nenad Noveljic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@NenadNoveljic\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nenad Noveljic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/\"},\"author\":{\"name\":\"Nenad Noveljic\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"headline\":\"Correlated Subqueries in the SELECT Clause\",\"datePublished\":\"2019-02-21T13:16:57+00:00\",\"dateModified\":\"2019-02-21T13:17:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/\"},\"wordCount\":574,\"commentCount\":1,\"articleSection\":[\"Comparison Oracle-SQL Server\",\"cost based optimizer\",\"Oracle\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/\",\"name\":\"Correlated Subqueries in the SELECT Clause - All-round Database Topics\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\"},\"datePublished\":\"2019-02-21T13:16:57+00:00\",\"dateModified\":\"2019-02-21T13:17:00+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\"},\"description\":\"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/correlated-subqueries-in-the-select-clause\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Correlated Subqueries in the SELECT Clause\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/\",\"name\":\"All-round Database Topics\",\"description\":\"Nenad Noveljic\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/#\\\/schema\\\/person\\\/51458d9dd86dbbdd19f5add451d44efa\",\"name\":\"Nenad Noveljic\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g\",\"caption\":\"Nenad Noveljic\"},\"sameAs\":[\"nenad-noveljic-9b746a6\",\"https:\\\/\\\/x.com\\\/NenadNoveljic\"],\"url\":\"https:\\\/\\\/nenadnoveljic.com\\\/blog\\\/author\\\/nenad\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Correlated Subqueries in the SELECT Clause - All-round Database Topics","description":"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/","og_locale":"en_US","og_type":"article","og_title":"Correlated Subqueries in the SELECT Clause - All-round Database Topics","og_description":"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.","og_url":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/","og_site_name":"All-round Database Topics","article_published_time":"2019-02-21T13:16:57+00:00","article_modified_time":"2019-02-21T13:17:00+00:00","author":"Nenad Noveljic","twitter_card":"summary_large_image","twitter_creator":"@NenadNoveljic","twitter_misc":{"Written by":"Nenad Noveljic","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/#article","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/"},"author":{"name":"Nenad Noveljic","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"headline":"Correlated Subqueries in the SELECT Clause","datePublished":"2019-02-21T13:16:57+00:00","dateModified":"2019-02-21T13:17:00+00:00","mainEntityOfPage":{"@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/"},"wordCount":574,"commentCount":1,"articleSection":["Comparison Oracle-SQL Server","cost based optimizer","Oracle","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/","url":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/","name":"Correlated Subqueries in the SELECT Clause - All-round Database Topics","isPartOf":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#website"},"datePublished":"2019-02-21T13:16:57+00:00","dateModified":"2019-02-21T13:17:00+00:00","author":{"@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa"},"description":"How Oracle and SQL Server optimize correlated subqueries in the SELECT clause with an example how to manually optimize such queries for Oracle.","breadcrumb":{"@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nenadnoveljic.com\/blog\/correlated-subqueries-in-the-select-clause\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nenadnoveljic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Correlated Subqueries in the SELECT Clause"}]},{"@type":"WebSite","@id":"https:\/\/nenadnoveljic.com\/blog\/#website","url":"https:\/\/nenadnoveljic.com\/blog\/","name":"All-round Database Topics","description":"Nenad Noveljic","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nenadnoveljic.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/nenadnoveljic.com\/blog\/#\/schema\/person\/51458d9dd86dbbdd19f5add451d44efa","name":"Nenad Noveljic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a97b796613ea48ec8a7b79c8ffe1c685dcffc920c68121f6238d5caab5070670?s=96&d=mm&r=g","caption":"Nenad Noveljic"},"sameAs":["nenad-noveljic-9b746a6","https:\/\/x.com\/NenadNoveljic"],"url":"https:\/\/nenadnoveljic.com\/blog\/author\/nenad\/"}]}},"_links":{"self":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/2375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/comments?post=2375"}],"version-history":[{"count":1,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/2375\/revisions"}],"predecessor-version":[{"id":2401,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/posts\/2375\/revisions\/2401"}],"wp:attachment":[{"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/media?parent=2375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/categories?post=2375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nenadnoveljic.com\/blog\/wp-json\/wp\/v2\/tags?post=2375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}