<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xmlns:tt="http://teletype.in/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/"><channel><title>@sql_query_performance</title><generator>teletype.in</generator><description><![CDATA[@sql_query_performance]]></description><link>https://teletype.in/@sql_query_performance?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance</link><atom:link rel="self" type="application/rss+xml" href="https://teletype.in/rss/sql_query_performance?offset=0"></atom:link><atom:link rel="next" type="application/rss+xml" href="https://teletype.in/rss/sql_query_performance?offset=10"></atom:link><atom:link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></atom:link><pubDate>Fri, 05 Jun 2026 21:03:28 GMT</pubDate><lastBuildDate>Fri, 05 Jun 2026 21:03:28 GMT</lastBuildDate><item><guid isPermaLink="true">https://teletype.in/@sql_query_performance/Qe4rnEK9Z</guid><link>https://teletype.in/@sql_query_performance/Qe4rnEK9Z?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance</link><comments>https://teletype.in/@sql_query_performance/Qe4rnEK9Z?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance#comments</comments><dc:creator>sql_query_performance</dc:creator><title>What is difference between data mart and data warehouse?</title><pubDate>Mon, 12 Oct 2020 06:33:38 GMT</pubDate><description><![CDATA[<img src="https://i0.wp.com/www.complexsql.com/wp-content/uploads/2017/06/Data-Mart.jpg?resize=300%2C160"></img>Data Warehouse is a big central repository of historical data. This data is assembled from different departments and units of the company. Data Mart can be considered as a subset of data warehouse or simply a data repository which is generally focused on a single functional area. They both primarily vary in their scope and usage area.]]></description><content:encoded><![CDATA[
  <blockquote><strong>Data Warehouse is a big central repository of historical data. This data is assembled from different departments and units of the company. Data Mart can be considered as a subset of data warehouse or simply a data repository which is generally focused on a single functional area. They both primarily vary in their scope and usage area.</strong></blockquote>
  <h2></h2>
  <p></p>
  <figure class="m_custom">
    <img src="https://i0.wp.com/www.complexsql.com/wp-content/uploads/2017/06/Data-Mart.jpg?resize=300%2C160" width="300" />
    <figcaption>Data Mart</figcaption>
  </figure>
  <h2>Data Mart vs Data warehouse :</h2>
  <p><strong>Data warehouse</strong> <strong>Data mart</strong>   Data warehousing is subject oriented, time variant, non-volatile collection of data which is used for creation of transactional reports as well as historical reports. <strong>Data Mart is simply a subset of Organization’s Data warehouse</strong> .These are most important concepts of <a href="https://www.complexsql.com/data-mining-interview-questions/" target="_blank">data mining.</a></p>
  <p> <strong>Definition:</strong></p>
  <p>The Data Warehouse is a large repository of data collected from different organizations or departments within a corporation.</p>
  <p><strong>Definition:</strong></p>
  <p>The data mart is an only subtype of a Data Warehouse. It is designed to meet the need of a certain user group.</p>
  <p><strong>Focus:</strong></p>
  <p>Data warehouse focuses on multiple business areas.</p>
  <p><strong>Focus:</strong></p>
  <p>Data mart focuses only on single subject area.</p>
  <p><strong>Usage:</strong></p>
  <p>It helps to take a strategic decision.</p>
  <p><strong>Usage:</strong></p>
  <p>The data mart is used to take tactical decisions for growth of business.</p>
  <p><strong>Type of system :</strong></p>
  <p>This is centralized system where one fact is at center surrounded by dimension tables.</p>
  <p><strong>Type of system :</strong></p>
  <p>Data mart system is de centralized system</p>
  <p><strong>Scope of Business:</strong></p>
  <p>The Data warehouse will cover all business areas.</p>
  <p><strong>Scope of Business:</strong></p>
  <p>The scope of Data mart is within the line of the Business.</p>
  <p><strong>Data Model:</strong></p>
  <p>Data warehouse always follows top-down model</p>
  <p><strong><a href="https://www.complexsql.com/data-modeling/" target="_blank">Data Model</a>:</strong></p>
  <p>Data mart always follows bottom-up model.</p>
  <p><strong>Data Size:</strong></p>
  <p>Data warehouse contains all historical data so the database size is large.Approximate size of data warehouse is greater than 100 GB.</p>
  <p><strong>Data Size:</strong></p>
  <p>Data mart contains data with only one business area so the size of database is smaller than data warehouse.</p>
  <p><strong>Source:</strong></p>
  <p>Data warehouse data comes from multiple heterogeneous data sources.</p>
  <p><strong>Source:</strong></p>
  <p>Data mart data is data of only one business area.Many times it will come from only one data source.</p>
  <p><strong>Implementation Time:</strong></p>
  <p>Data warehouse contains all data which will come from multiple data sources. It will take time to build data warehouse. The Time to build data warehouse is months to years.</p>
  <p><strong>Implementation Time:</strong></p>
  <p>Data mart is small data warehouse which will contain the data of only a single business area. The implementation time to build data mart is in months.</p>
  <p>Hope you like this Data Mart vs Data warehouse article. If you have any suggestions about Data Mart vs Data warehouse article kindly comment in comment section.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@sql_query_performance/wkSELugjJ</guid><link>https://teletype.in/@sql_query_performance/wkSELugjJ?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance</link><comments>https://teletype.in/@sql_query_performance/wkSELugjJ?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance#comments</comments><dc:creator>sql_query_performance</dc:creator><title>What is difference between simple view and complex view?</title><pubDate>Mon, 05 Oct 2020 10:28:29 GMT</pubDate><description><![CDATA[<img src="http://www.complexsql.com/wp-content/uploads/2017/02/viewsisql-300x223.jpg"></img>Views in SQL is nothing but the logical table created from one or more tables.We can use the views to fetch the columns from one or more different tables at a time.In real life specifically views are used in Reporting purpose.To create a report we need data from different tables and need to show it on a single dashboard so we are using the views to fetch the data from different tables.View can contain all rows from the table or selected rows from the table.]]></description><content:encoded><![CDATA[
  <ul>
    <li><strong>Views in SQL:</strong></li>
  </ul>
  <p>Views in SQL is nothing but the logical table created from one or more tables.We can use the views to fetch the columns from one or more different tables at a time.In real life specifically views are used in Reporting purpose.To create a report we need data from different tables and need to show it on a single dashboard so we are using the views to fetch the data from different tables.View can contain all rows from the table or selected rows from the table.</p>
  <p><a href="http://www.complexsql.com/materialized-view/" target="_blank">CLICK HERE TO GET INFORMATION ON MATERIALIZED VIEW.</a></p>
  <blockquote>View is nothing but virtual table in sql which will fetch data from one or more physical tables</blockquote>
  <h3>There are 2 types of views in SQL:</h3>
  <p>1.Simple View-Simple view is view created on single table</p>
  <p>2.Complex View-Complex view is view created on more than 1 tables</p>
  <ul>
    <li>Simple View:</li>
  </ul>
  <p>When user wants data or some columns from same table then simple view is used.For an example if there is employee table which has Employee_num,Employee_name,salary columnns and we just need to see Employee_num,Employee_name then user can create a simple view.</p>
  <p>Employee_num Employee_name Department Salary   1 Amit OBIEE 680000   2 Rohan OBIEE 550000   3 Rohit OBIEE 430000</p>
  <figure class="m_custom">
    <img src="http://www.complexsql.com/wp-content/uploads/2017/02/viewsisql-300x223.jpg" width="300" />
  </figure>
  <p>We want to restrict data from the above table and show only Employee_Num and Employee_name then we will use the view.</p>
  <blockquote>Syntax: Create view Viewname as Select column_name1,Coumn_name2 from tablename. Example: Create view V_Employee as Select Employee_num,Employee_name from Employee;</blockquote>
  <p>You can access the view using Select statement of SQL:</p>
  <p>select * from V_Employee;</p>
  <p>Output:</p>
  <p>Employee_num Employee_name   1 Amit   2 Rohan   3 Rohit</p>
  <ul>
    <li>Complex View:</li>
  </ul>
  <p>Complex view is created on using more than one tables.When user wants to retrieve data from more than 1 table then we have to use complex views.To create complex view there should be relation between 2 tables else cartesian product will come by joining 2 tables.There should be some joining conditions,some filters needs to be considered while creating complex views.</p>
  <figure class="m_custom">
    <img src="http://tracking.vcommission.com/aff_i?offer_id=22&file_id=124708&aff_id=60738" width="1" />
  </figure>
  <p>Suppose there are 2 tables:</p>
  <p>1.Employee tables:-Employee_name,Employee_num,Department_code columns</p>
  <p>2.Department:-Department_code,Deptartment_name columns</p>
  <p>We need to create view where we want to show the associated department to employee.Here We need to use complex join.</p>
  <blockquote>Create view V_EMP_DEPT as Select e.Employee_name,d.Department_name from Employee e,Department d where e.Department_code=d.Department_code;</blockquote>
  <p>If you have any issues regarding SQL Views or If you want notes in PDF format comment below section.</p>

]]></content:encoded></item><item><guid isPermaLink="true">https://teletype.in/@sql_query_performance/aN82oB1o_</guid><link>https://teletype.in/@sql_query_performance/aN82oB1o_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance</link><comments>https://teletype.in/@sql_query_performance/aN82oB1o_?utm_source=teletype&amp;utm_medium=feed_rss&amp;utm_campaign=sql_query_performance#comments</comments><dc:creator>sql_query_performance</dc:creator><title>SQL Query Performance Improvement</title><pubDate>Mon, 05 Oct 2020 10:24:51 GMT</pubDate><description><![CDATA[<img src="http://www.complexsql.com/wp-content/uploads/2017/01/ttuning-300x180.png"></img>SQL statements are basically used for manipulation of data or data retrieval.When we consider the large software,industrial software it has very high volume of data.So there is huge need of tuning the query which will improves the performance of data and application.There are lot of factors we need to consider in Performance tuning like the Server hardware,Speed of Server,Database using,Volume of data e.t.c.In this article i am giving you the basic idea of SQL Performance Tuning Techniques.We will get same result using multiple type of queries.But by considering the cost and execution of the query we will able to tune our sql and improve the performance.]]></description><content:encoded><![CDATA[
  <p>SQL statements are basically used for manipulation of data or data retrieval.When we consider the large software,industrial software it has very high volume of data.So there is huge need of tuning the query which will improves the performance of data and application.There are lot of factors we need to consider in Performance tuning like the Server hardware,Speed of Server,Database using,Volume of data e.t.c.In this article i am giving you the basic idea of SQL Performance Tuning Techniques.We will get same result using multiple type of queries.But by considering the cost and execution of the query we will able to tune our sql and improve the performance.</p>
  <blockquote><strong>SQL Performance Tuning Techniques is the process of ensuring that the SQL statements will run in the fastest possible time.</strong></blockquote>
  <ul>
    <li><strong>Tune your SQL here:</strong></li>
  </ul>
  <p>Following are some basic tips using which you will able to optimize your query and improve SQL Performance Tuning Techniques .The first step to check is cost of your query.For checking the cost of query use following simple command.I will explain the</p>
  <figure class="m_custom">
    <img src="http://www.complexsql.com/wp-content/uploads/2017/01/ttuning-300x180.png" width="300" />
  </figure>
  <p>&#x27;Explain&#x27; statement in detail in my other advanced tuning articles.As of now just refer following statement to find out the cost of query.More the cost less the performance of query.</p>
  <blockquote>Explain [Query] Explain Select * from Employee;</blockquote>
  <h3>How to improve SQL Query Performance? - Tips and Examples</h3>
  <h4>Check 1 : Need to Avoid <a href="https://www.complexsql.com/how-to-join-3-tables-in-sql-joining-3-tables-with-examples/" target="_blank">Multiple number of Joins</a></h4>
  <p>1. There is common practice where we are using the unnecessary multiple joins.</p>
  <p>2.If you see the explain plan the joins cost is very high.</p>
  <p>3.We require to check all the joins and remove the unnecessary joins by restructuring query.</p>
  <h4>Check 2 : <a href="https://www.complexsql.com/ora-01000/" target="_blank">Cursors</a> Illumination</h4>
  <p>1.We require to revisit the outputs of multiple queries and need to remove the unnecessary cursors.</p>
  <p>2.Dynamic cursors limits the optimizer to use nested loop joins.</p>
  <p>3.We require to avoid cursors and use set-based queries instead of cursors.</p>
  <h4>Check 3 : Avoid non-correlated sub queries</h4>
  <p>1. There are so many times due to bad SQL techniques the people are using the non correlated sub-queries.</p>
  <p>2.We require to use correlated sub queries.</p>
  <h4>Check 4 : Avoid the costly functions and statements</h4>
  <p>1.We require to check the system<a href="https://gpdb.docs.pivotal.io/580/best_practices/tuning_queries.html" target="_blank"> functions and its cost</a> .</p>
  <p>2.We require to avoid distinct or count like functions wherever possible. These functions are costly and will reduce the cost.</p>
  <h4>Check 5 : Need to create correct<a href="https://www.complexsql.com/indexing-in-sql/" target="_blank"> index on correct places</a></h4>
  <p>1.We require to create the indexes on correct places.</p>
  <p>2.We require to reduce the data retrieval time for queries.</p>
  <p>3.We require to create highly selective indexes by checking and analyzing data.</p>
  <h4>Check 6 : Check the data volume</h4>
  <p>1.We require to check the data volume of statement.</p>
  <p>2.We need to review the data volume and apply<a href="https://www.complexsql.com/table-partitioning/" target="_blank"> the partitioning techniques</a> accordingly.</p>
  <h4>check 7 : Drop unused indexes</h4>
  <p>1. We require to check the low performing indexes and unused indexes.</p>
  <p>2.We need to recreate the good indexes and remove the unused indexes.</p>
  <h4>check 8 : Create Stats with update stats :</h4>
  <p>1.There are so many times when we forget to <a href="https://www.complexsql.com/gather-stats-in-oracle-schematables-and-indexes/" target="_blank">gather stats of tables,indexes or schemas.</a></p>
  <p>2.We need to gather stats and set some jobs to gather stats on regular basis.</p>
  <h4>Check 9 : Need to check the constraints</h4>
  <p>1.There are so many times when the performance will decrease because of the constraints</p>
  <p>2.We need too revisit the design and check the primary key,foreign key and not null and check constraints.</p>
  <p><strong>Some tips to improve the SQL Performance :</strong></p>
  <p><strong>Tip 1: Never use *(Star) to fetch all records from table</strong></p>
  <p>Sql query become fast if you use actual columns instead of * to fetch all the records from the table.</p>
  <blockquote><strong>Not Recommended:</strong> Select * from Employee; <strong>Recommended:</strong> Select Eno,Ename,Address from Employee;</blockquote>
  <ul>
    <li><strong>Tip 2: Try to avoid distinct keyword from the query</strong></li>
  </ul>
  <p>Try to avoid distinct keyword from select statements.Distinct keyword has high cost and low performance.When anyone uses distinct keyword it first sorts the data from column and then fetches the distinct values.Use exist operator inspite of distinct keyword.</p>
  <blockquote><strong>Not Recommendedd:</strong> SELECT DISTINCT d.dept_no, d.department_name<br />FROM Department d,Employee e<br />WHERE d.dept_no= e.dept_no; Recommended: SELECT d.dept_no d.department_name<br />FROM Department d<br />WHERE EXISTS ( SELECT &#x27;X&#x27; FROM Employee e WHERE d.dept_no= e.dept_no);</blockquote>
  <p><a href="http://www.complexsql.com/sql-performance-indexing-in-sql-types-of-indexes-in-sql/" target="_blank">INTERVIEW QUESTIONS ON PERFORMANCE TUNING</a></p>
  <ul>
    <li><strong>Tip 3:Carefully use where conditions in sql</strong></li>
  </ul>
  <p>Try to use correct operator as per requirement given.</p>
  <blockquote><strong>Not Recommended:</strong> Select * from Employee where salary != 65000; <strong>Recommended:</strong> Select * from Employee where salary &gt; 65000 and salary &lt; 65000;</blockquote>
  <ul>
    <li><strong>Tip 4: Use Like operator in spite of equal to (=)</strong></li>
  </ul>
  <blockquote>Not Recommended: Select * from Employee where name=&#x27;Amit&#x27;; Recommended: Select * from Employee where name like &#x27;Amit%&#x27;;</blockquote>
  <ul>
    <li><strong>Tip 5: Avoid having clause/group by statements</strong></li>
  </ul>
  <p>Having clause and group by statements have high cost.So try to avoid it in sql query.</p>
  <blockquote>Not Recommended: Select * from Employee where name=&#x27;Amit&#x27; group by department having salary=45000; Recommended: Select * from Employee where name=&#x27;Amit&#x27; and salary=45000;</blockquote>
  <p><strong>Tip 6: Use of Exist and In Operators</strong></p>
  <p>Basically Operator IN has lowest performance.IN operator is used when Filter criteria is in subquery whereas Exist operator is used when filter criteria is in main query.</p>
  <blockquote><strong>Example:</strong> <strong>In Operator:</strong> Select * from Employee where Department_name In(Select Department_name from Department where Dno=10); <strong>Exist operator:</strong> Select * from Employee where Exist(Select Department_name from Department where Dno=10);</blockquote>
  <p>Try to use union all inspite of union.As union scans all data first and then eliminate duplicate so it has slow performance.</p>
  <blockquote><strong>Not Recommended:</strong> Select * from Employee where dept_no=10 Union Select * from Employee where dept_no=20; <strong>Recommended:</strong> Select * from Employee where dept_no=10 Union All Select * from Employee where dept_no=20;</blockquote>
  <ul>
    <li><strong>Tip 8: Avoid use of Functions in Where condition.</strong></li>
  </ul>
  <blockquote><strong>Not Recommended:</strong> Select * from Employee where Substr(name,1,3)=&#x27;Ami&#x27;; <strong>Recommended:</strong> Select * from Employee where name like &#x27;Ami%&#x27;;</blockquote>
  <p><a href="http://www.complexsql.com/parser-and-optimizer-in-sql/" target="_blank">About SQL OPTIMIZER AND PARSER</a></p>
  <p>I have explained the Basic tips which is used to improve and optimize performance of SQL Queries.Hope this article is helpful to you to improve the performance of your sql queries.</p>

]]></content:encoded></item></channel></rss>