{"id":241594,"date":"2023-06-06T08:38:27","date_gmt":"2023-06-06T15:38:27","guid":{"rendered":"https:\/\/virtual-dba.com\/?p=241594"},"modified":"2023-06-16T21:55:49","modified_gmt":"2023-06-17T04:55:49","slug":"indexing-for-group-by-and-order-by-in-sql-server","status":"publish","type":"post","link":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/","title":{"rendered":"Indexing for Group By and Order By in SQL Server"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Indexing?<\/h2>\n\n\n\n<p>Indexing is a technique to optimize the selection and sorting of data in a database. An index is a data structure that stores a subset of columns from a table or a view, along with pointers to the corresponding rows. The database can use an index to quickly locate and retrieve the rows that match a given condition or order.<\/p>\n\n\n\n<p>There are two main types of indexes in SQL Server: clustered and non-clustered. A clustered index defines the physical order of the rows in the table or view. There can be only one clustered index per table or view. A non-clustered index is a separate data structure from the table or view that stores a copy of some columns and pointers to the rows. There can be multiple non-clustered indexes per table or view.<\/p>\n\n\n\n<p>Indexes can improve the performance of queries by reducing the amount of data that needs to be scanned or sorted at runtime. However, indexes also have some drawbacks, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>They consume disk space and memory.<\/li>\n\n\n\n<li>They must be maintained when the data changes, which can cause overhead and fragmentation.<\/li>\n\n\n\n<li>The query optimizer may not use them if they are unsuitable for the query or outdated or inaccurate.<\/li>\n<\/ul>\n\n\n\n<p>Therefore, it is vital to design and implement indexes carefully based on the characteristics of the data and the queries.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Indexing for Group By<\/h2>\n\n\n\n<p>The GROUP BY clause is used to aggregate data into groups based on some common values. For example, if you want to calculate the total sales amount for each product category, you can use a query like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT ProductCategory, SUM(SalesAmount) AS TotalSales\nFROM Sales\nGROUP BY ProductCategory<\/code><\/pre>\n\n\n\n<p>The query will scan all the rows in the Sales table and group them by ProductCategory. Then, it will apply the SUM function to each group and return the result.<\/p>\n\n\n\n<p>To improve the performance of this query, you can create an index on the ProductCategory column. This index will allow the database to scan only the index instead of the whole table and use the sorted order of the index to group the rows by ProductCategory. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE INDEX IX_Sales_ProductCategory ON Sales(ProductCategory)<\/code><\/pre>\n\n\n\n<p>This index will cover both the grouping and selecting columns of the query so that it will be very efficient.<\/p>\n\n\n\n<p>However, not all queries that use GROUP BY can benefit from indexing. Some factors can affect whether an index will be used or not by the query optimizer, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The selectivity of the index:<\/strong> If the index covers only a small percentage of rows in the table, it is more likely to be used than an index that covers most or all rows.<\/li>\n\n\n\n<li><strong>The cardinality of the index: <\/strong>If the index has many distinct values, it is more likely to be used than an index with few or repeated values.<\/li>\n\n\n\n<li><strong>The index size:<\/strong> If the index is too large or has too many columns, it may not fit in memory or cause more I\/O than scanning the table.<\/li>\n\n\n\n<li><strong>The statistics of the index:<\/strong> If the statistics of the index are outdated or inaccurate, they may not reflect the actual data distribution in the table or index and lead to suboptimal query plans.<\/li>\n\n\n\n<li><strong>The query hints:<\/strong> If you use query hints to force or prevent using an index, you may override the query optimizer&#8217;s decision.<\/li>\n<\/ul>\n\n\n\n<p>Therefore, you should always test your queries and indexes on realistic data and workload and monitor their performance and execution plans.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Indexing for Order By<\/h2>\n\n\n\n<p>The ORDER BY clause is used to sort data in a specified order. For example, if you want to list the products by their list price in descending order, you can use a query like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT Name, ListPrice\nFROM Production.Product\nORDER BY ListPrice DESC<\/code><\/pre>\n\n\n\n<p>The query will scan all the rows in the Product table and sort them by ListPrice column in descending order. Then, it will return the result.<\/p>\n\n\n\n<p>To improve the performance of this query, you can create an index on the ListPrice column. This index will allow the database to scan only the index instead of the whole table and return the rows without sorting them. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE INDEX IX_Product_ListPrice \nON Production.Product(ListPrice DESC)<\/code><\/pre>\n\n\n\n<p>This index will cover both the selecting and sorting columns of the query so that it will be very efficient.<\/p>\n\n\n\n<p>However, not all queries that use ORDER BY can benefit from indexing. There are some factors that can affect whether an index will be used or not by the query optimizer, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>The direction of the index: <\/strong>If the index is in a different order than the ORDER BY clause, it may not be used, or it may require an additional sort operation. For example, if you have an index on the ListPrice column in ascending order but want to order by ListPrice column in descending order, the index may not be helpful.<\/li>\n\n\n\n<li><strong>The columns of the index:<\/strong> If the index has more columns than the ORDER BY clause, it may not be used, or it may require an additional sort operation. For example, if you have an index on ListPrice and Name columns but only want to order by ListPrice column, the index may not be helpful.<\/li>\n\n\n\n<li><strong>The selectivity of the index:<\/strong> If the index covers only a small percentage of rows in the table, it is more likely to be used than an index that covers most or all rows.<\/li>\n\n\n\n<li><strong>The cardinality of the index:<\/strong> If the index has many distinct values, it is more likely to be used than an index with few or repeated values.<\/li>\n\n\n\n<li><strong>The index size: <\/strong>If the index is too large or has too many columns, it may not fit in memory or cause more I\/O than scanning the table.<\/li>\n\n\n\n<li><strong>The statistics of the index:<\/strong> If the statistics of the index are outdated or inaccurate, they may not reflect the actual distribution of data in the table or index and lead to suboptimal query plans.<\/li>\n\n\n\n<li><strong>The query hints: <\/strong>If you use query hints to force or prevent using an index, you may override the query optimizer&#8217;s decision.<\/li>\n<\/ul>\n\n\n\n<p>Therefore, you should always test your queries and indexes on realistic data and workload and monitor their performance and execution plans.<\/p>\n\n\n\n<p>In this blog, we learned how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server. We saw some examples of how creating indexes on the grouping and sorting columns can reduce the amount of data that needs to be scanned or sorted by the database engine.<\/p>\n\n\n\n<p>However, we also learned that indexing for GROUP BY and ORDER BY is not always beneficial and that some factors can affect whether an index will be used or not by the query optimizer. Therefore, we should always test our queries and indexes on realistic data and workload and monitor their performance and execution plans.<\/p>\n\n\n\n<p>We look forward to hearing from you and helping you with your database needs.<\/p>\n\n\n\n<p>Please <a href=\"https:\/\/virtual-dba.com\/contact-us\/\">contact us<\/a> for more information, and have a great day!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Indexing? Indexing is a technique to optimize the selection and sorting of data in a database. An index is a data structure that stores a subset of columns from a table or a view, along with pointers to the corresponding rows. The database can use an index to quickly locate and retrieve the [&hellip;]<\/p>\n","protected":false},"author":59,"featured_media":241602,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","content-type":"","footnotes":""},"categories":[4166,55],"tags":[3492,60],"class_list":["post-241594","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-sql-server","tag-indexes","tag-sql-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.1 (Yoast SEO v27.1.1) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Indexing for Group By and Order By in SQL Server | VDBA<\/title>\n<meta name=\"description\" content=\"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Indexing for Group By and Order By in SQL Server\" \/>\n<meta property=\"og:description\" content=\"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-06T15:38:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-17T04:55:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"557\" \/>\n\t<meta property=\"og:image:height\" content=\"291\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ken Haff\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virtual_dba\" \/>\n<meta name=\"twitter:site\" content=\"@virtual_dba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ken Haff\" \/>\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:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\"},\"author\":{\"name\":\"Ken Haff\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/8921c8551455c88e6da338f28f7db365\"},\"headline\":\"Indexing for Group By and Order By in SQL Server\",\"datePublished\":\"2023-06-06T15:38:27+00:00\",\"dateModified\":\"2023-06-17T04:55:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\"},\"wordCount\":1156,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/virtual-dba.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg\",\"keywords\":[\"Indexes\",\"sql server\"],\"articleSection\":[\"Blog\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\",\"url\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\",\"name\":\"Indexing for Group By and Order By in SQL Server | VDBA\",\"isPartOf\":{\"@id\":\"https:\/\/virtual-dba.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg\",\"datePublished\":\"2023-06-06T15:38:27+00:00\",\"dateModified\":\"2023-06-17T04:55:49+00:00\",\"description\":\"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.\",\"breadcrumb\":{\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage\",\"url\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg\",\"contentUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg\",\"width\":557,\"height\":291,\"caption\":\"Indexing for Group By and Order By in SQL Server\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtual-dba.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Indexing for Group By and Order By in SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtual-dba.com\/#website\",\"url\":\"https:\/\/virtual-dba.com\/\",\"name\":\"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts\",\"description\":\"Remote Database Administration\",\"publisher\":{\"@id\":\"https:\/\/virtual-dba.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtual-dba.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/virtual-dba.com\/#organization\",\"name\":\"Virtual-DBA: Remote DBA | Remote Database Administration\",\"alternateName\":\"Virtual-DBA powered by XTIVIA\",\"url\":\"https:\/\/virtual-dba.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg\",\"contentUrl\":\"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg\",\"width\":557,\"height\":291,\"caption\":\"Virtual-DBA: Remote DBA | Remote Database Administration\"},\"image\":{\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/virtual_dba\",\"https:\/\/www.linkedin.com\/showcase\/36220649\/\",\"https:\/\/www.youtube.com\/channel\/UCx3AIeUQ2ziTLKZSJDZ-SEg\"],\"description\":\"Eliminate database downtime and spiraling costs with XTIVIA\u2019s Virtual-DBA. In today\u2019s always-on business world, gaps in 24x7 on-call DBA support, neglected maintenance and security, or a stretched team struggling with overwhelming workloads can lead to costly disruptions and threaten business continuity. XTIVIA\u2019s Virtual-DBA provides the immediate, expert database administration you need, exactly when you need it, ensuring optimal performance, ironclad security, and significant cost savings without the burden of expanding your in-house team. The goal of Virtual-DBA is to provide a cost-effective solution for organizations seeking to optimize the security, management, maintenance, availability, and performance of their critical business systems, whether self-managed or cloud-managed (e.g., AWS RDS, Azure SQL Database). We accomplish this through a comprehensive remote DBA service offering designed specifically to meet the Oracle\u00ae, DB2\u00ae, Informix\u00ae, MySQL\u2122, PostgreSQL\u00ae, MongoDB\u00ae, MariaDB, and Microsoft SQL Server\u00ae, CockroachDB, Databricks, AWS, and Azure needs of our clients.\",\"email\":\"info@xtivia.com\",\"telephone\":\"8886853101\",\"legalName\":\"XTIVIA, Inc\",\"foundingDate\":\"1992-05-01\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"201\",\"maxValue\":\"500\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/8921c8551455c88e6da338f28f7db365\",\"name\":\"Ken Haff\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtual-dba.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/771e9bc96721a00bb741fc19620fa62a291df050a23dd669af66b0a6f7f121f5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/771e9bc96721a00bb741fc19620fa62a291df050a23dd669af66b0a6f7f121f5?s=96&d=mm&r=g\",\"caption\":\"Ken Haff\"},\"url\":\"https:\/\/virtual-dba.com\/author\/ken-haff\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Indexing for Group By and Order By in SQL Server | VDBA","description":"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.","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:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/","og_locale":"en_US","og_type":"article","og_title":"Indexing for Group By and Order By in SQL Server","og_description":"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.","og_url":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/","og_site_name":"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts","article_published_time":"2023-06-06T15:38:27+00:00","article_modified_time":"2023-06-17T04:55:49+00:00","og_image":[{"width":557,"height":291,"url":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg","type":"image\/jpeg"}],"author":"Ken Haff","twitter_card":"summary_large_image","twitter_creator":"@virtual_dba","twitter_site":"@virtual_dba","twitter_misc":{"Written by":"Ken Haff","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#article","isPartOf":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/"},"author":{"name":"Ken Haff","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/8921c8551455c88e6da338f28f7db365"},"headline":"Indexing for Group By and Order By in SQL Server","datePublished":"2023-06-06T15:38:27+00:00","dateModified":"2023-06-17T04:55:49+00:00","mainEntityOfPage":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/"},"wordCount":1156,"commentCount":0,"publisher":{"@id":"https:\/\/virtual-dba.com\/#organization"},"image":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg","keywords":["Indexes","sql server"],"articleSection":["Blog","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/","url":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/","name":"Indexing for Group By and Order By in SQL Server | VDBA","isPartOf":{"@id":"https:\/\/virtual-dba.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage"},"image":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage"},"thumbnailUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg","datePublished":"2023-06-06T15:38:27+00:00","dateModified":"2023-06-17T04:55:49+00:00","description":"Learn how to use indexes to improve the performance of queries that use the GROUP BY and ORDER BY clauses in SQL Server.","breadcrumb":{"@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#primaryimage","url":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg","contentUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/Indexing-for-Group-By-and-Order-By-in-SQL-Server.jpg","width":557,"height":291,"caption":"Indexing for Group By and Order By in SQL Server"},{"@type":"BreadcrumbList","@id":"https:\/\/virtual-dba.com\/blog\/indexing-for-group-by-and-order-by-in-sql-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtual-dba.com\/"},{"@type":"ListItem","position":2,"name":"Indexing for Group By and Order By in SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/virtual-dba.com\/#website","url":"https:\/\/virtual-dba.com\/","name":"Virtual-DBA Remote DBA Services &amp; Support - Certified Database Experts","description":"Remote Database Administration","publisher":{"@id":"https:\/\/virtual-dba.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtual-dba.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/virtual-dba.com\/#organization","name":"Virtual-DBA: Remote DBA | Remote Database Administration","alternateName":"Virtual-DBA powered by XTIVIA","url":"https:\/\/virtual-dba.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/","url":"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg","contentUrl":"https:\/\/virtual-dba.com\/wp-content\/uploads\/V-DBA-Database-Services-and-Support-Featured-Logo.jpg","width":557,"height":291,"caption":"Virtual-DBA: Remote DBA | Remote Database Administration"},"image":{"@id":"https:\/\/virtual-dba.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/virtual_dba","https:\/\/www.linkedin.com\/showcase\/36220649\/","https:\/\/www.youtube.com\/channel\/UCx3AIeUQ2ziTLKZSJDZ-SEg"],"description":"Eliminate database downtime and spiraling costs with XTIVIA\u2019s Virtual-DBA. In today\u2019s always-on business world, gaps in 24x7 on-call DBA support, neglected maintenance and security, or a stretched team struggling with overwhelming workloads can lead to costly disruptions and threaten business continuity. XTIVIA\u2019s Virtual-DBA provides the immediate, expert database administration you need, exactly when you need it, ensuring optimal performance, ironclad security, and significant cost savings without the burden of expanding your in-house team. The goal of Virtual-DBA is to provide a cost-effective solution for organizations seeking to optimize the security, management, maintenance, availability, and performance of their critical business systems, whether self-managed or cloud-managed (e.g., AWS RDS, Azure SQL Database). We accomplish this through a comprehensive remote DBA service offering designed specifically to meet the Oracle\u00ae, DB2\u00ae, Informix\u00ae, MySQL\u2122, PostgreSQL\u00ae, MongoDB\u00ae, MariaDB, and Microsoft SQL Server\u00ae, CockroachDB, Databricks, AWS, and Azure needs of our clients.","email":"info@xtivia.com","telephone":"8886853101","legalName":"XTIVIA, Inc","foundingDate":"1992-05-01","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"201","maxValue":"500"}},{"@type":"Person","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/8921c8551455c88e6da338f28f7db365","name":"Ken Haff","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtual-dba.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/771e9bc96721a00bb741fc19620fa62a291df050a23dd669af66b0a6f7f121f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/771e9bc96721a00bb741fc19620fa62a291df050a23dd669af66b0a6f7f121f5?s=96&d=mm&r=g","caption":"Ken Haff"},"url":"https:\/\/virtual-dba.com\/author\/ken-haff\/"}]}},"_links":{"self":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts\/241594","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/users\/59"}],"replies":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/comments?post=241594"}],"version-history":[{"count":0,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/posts\/241594\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/media\/241602"}],"wp:attachment":[{"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/media?parent=241594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/categories?post=241594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtual-dba.com\/wp-json\/wp\/v2\/tags?post=241594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}