{"id":3366,"date":"2018-03-02T11:08:12","date_gmt":"2018-03-02T11:08:12","guid":{"rendered":"http:\/\/bicortex.com\/?p=3366"},"modified":"2018-06-15T12:40:40","modified_gmt":"2018-06-15T12:40:40","slug":"vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-3","status":"publish","type":"post","link":"http:\/\/bicortex.com\/bicortex\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-3\/","title":{"rendered":"Vertica MPP Database Overview and TPC-DS Benchmark Performance Analysis (Part 3)"},"content":{"rendered":"<p class=\"Standard\" style=\"text-align: justify;\">In <a href=\"http:\/\/bicortex.com\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-1\/\" target=\"_blank\" rel=\"noopener\">Post 1<\/a> I outlined the key architectural principles behind Vertica\u2019s design and what makes it one of the top MPP\/analytical databases available today. In <a href=\"http:\/\/bicortex.com\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-2\/\" target=\"_blank\" rel=\"noopener\">Post 2<\/a> I went over the installation process across one and multiple nodes as well as some of Vertica\u2019s &#8216;knobs and buttons&#8217; which give the administrator a comprehensive snapshot of the system performance. In this instalment I will focus on loading the data into Vertica\u2019s cluster and running some analytical queries across TPC-DS datasets to compare execution times for single and multi-node environments. The comparison is not attempting to contrast Vertica\u2019s performance with any of its competing MPP database vendors e.g. Greenplum or AWS Redshift (that may come in the future posts). Rather, the purpose of this post is to ascertain how queries execution are impacted based on the number of nodes in the cluster and whether the performance increases or decreases yielded were linear. Also, given that Vertica is a somewhat esoteric DBMS, I wanted to highlight the fact that with a fairly minimum set up and configuration, this MPP database can provide a lot of bang for your buck when dealing with analytical workloads. Yes, most developers or analysts would love nothing more than to jump on the cloud bandwagon and use &#8216;ops-free&#8217; Google&#8217;s BigQuery or even AWS Redshift but the reality is that most SMBs are not ready to pivot their operational model and store their customers&#8217; data in the public cloud. Databases like Vertica provide a reasonable alternative to a long established players in this market e.g. Oracle DB or IBM DB2 and allow the so-called big data demands to be addressed with relative ease i.e. multi-model deployment, full-featured SQL API, MPP architecture, in-database machine learning etc.<\/p>\n<h3 style=\"text-align: center;\">Cluster Setup and Data Load<\/h3>\n<p class=\"Standard\" style=\"text-align: justify;\">There are quite a few data sets and methodologies that can be used to gauge data storage and processing system\u2019s performance e.g.\u00a0<a href=\"http:\/\/www.nyc.gov\/html\/tlc\/html\/about\/trip_record_data.shtml\" target=\"_blank\" rel=\"noopener\"><strong>TLC Trip Record Data<\/strong><\/a>\u00a0released by the New York City Taxi &amp; Limousine Commission has gained a lot of traction amongst big data specialists, however, \u00a0TPC-approved benchmarks have long been considered as the most objective, vendor-agnostic way to perform data-specific hardware and software comparisons, capturing the complexity of modern business processing to a much greater extent than its predecessors. I have briefly outlined data generation mechanism used in the TPC-DS suite of tools in my previous blog <a href=\"http:\/\/bicortex.com\/tpc-ds-big-data-benchmark-overview-how-to-generate-and-load-sample-data\/\" target=\"_blank\" rel=\"noopener\">HERE<\/a> so I will skip the details and use three previously generated datasets for this demo \u2013 one with the scaling factor of 100 (~100GB), one with the scaling factor of 200 (~200GB) and another with the scaling factor of 300 (~300GB). All three datasets have not turned out to be perfectly uniform in terms of expected rows count (presumably due to selecting the unsupported scaling factors), with large deviations recorded across some files e.g. &#8216;inventory&#8217; table containing fewer records in 200GB dataset than in the 100GB one. However, the three datasets were quite linear in terms of raw data volume increases which was also reflected in runtimes across number of subsequent queries.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Row_Counts.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3473\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Row_Counts.png\" alt=\"\" width=\"580\" height=\"505\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Row_Counts.png 673w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Row_Counts-300x261.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Data_Size.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3474\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Data_Size.png\" alt=\"\" width=\"580\" height=\"533\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Data_Size.png 638w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Data_Size-300x276.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">As mentioned in Post 2, the hardware used for this demo is not exactly what you would have in mind when provisioning an enterprise-class database cluster. With that in mind, the results of all the analytical queries I run are only indicative of the performance level in the context of the same data and configuration used. Chances are that with a proper, server-level hardware this comparison would be like going from the Wright brothers first airplane to Starship Enterprise but at least I endeavoured to make this as empirical as possible. To be completely transparent, here is the view of how these tiny Lenovo desktops are configured.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Cluster_Hardware_Specs_Outline.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3371\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Cluster_Hardware_Specs_Outline.png\" alt=\"\" width=\"580\" height=\"468\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Hardware_Specs_Outline.png 801w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Hardware_Specs_Outline-300x242.png 300w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Hardware_Specs_Outline-768x619.png 768w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">Also, for good measure I run a quick test on the storage performance using the &#8216;measure_locatioon_performance&#8217; vsql function run on one of the machines (all three nodes are identical in terms of the individual components setup). These units are equipped with an SSD each (as opposed to a slower mechanical drive), however, their SATA2 interface limits the transfer rates of what these Crucial MX300 are technically capable of to just over 360 MB\/sec as per the image below.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Cluster_Location_Speed_Test.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3372\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Cluster_Location_Speed_Test.png\" alt=\"\" width=\"580\" height=\"184\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Location_Speed_Test.png 781w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Location_Speed_Test-300x95.png 300w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Cluster_Location_Speed_Test-768x244.png 768w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">Finally, the fact I\u2019m pushing between 100 and 300 gigabytes of data through this cluster with only 16GB of memory available per node means that most of the data needs to be read from disk. Most analytical databases are designed to cache data in memory, providing minimal latency and fast response time. As this hardware does not do justice to the data volumes queried in this demo, with proper reference architecture for this type of system I am certain that the performance would increase by an order of magnitude.<\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">Vertica documentation provides a detail outline of different techniques used to load, transform and monitor the acquisitions. As reiterating the details of all the options and approaches is outside the scope of this post, I will only touch on some of the core concepts &#8211; for a comprehensive guide on data loading best practices and different options available please refer to their documentation or\u00a0<a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Visual_Guide_to_Loading_in_HPE_Vertica.pdf\" target=\"_blank\" rel=\"noopener\">THIS<\/a> visual guide. By far, the most effective way to load the data into Vertica is using COPY command. The COPY statement loads data from a file stored on the host or client (or in a data stream) into a database table. You can pass the COPY statement many different parameters to define various options such as: the format of the incoming data, metadata about the data load, which parser COPY should use, how to transform data as it is loaded or how to handle errors. Vertica\u2019s hybrid storage model provides a great deal of flexibility for loading and managing data.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Data_Load_Methods.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3380\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/05\/Vertica_Data_Load_Methods.png\" alt=\"\" width=\"580\" height=\"377\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Data_Load_Methods.png 807w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Data_Load_Methods-300x195.png 300w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/05\/Vertica_Data_Load_Methods-768x500.png 768w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">For this demo I copied and staged the three data sets \u2013 100GB, 200GB and 300GB &#8211; on the m92p1 host (node no1 in my makeshift 3-node cluster) and used the following shell script to (1) create necessary tables on the previously created &#8216;vtest&#8217; database and &#8216;tpc_ds&#8217; schema and (2) load the data into the newly created tables.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#!\/bin\/bash\r\nVPASS=&quot;YourPassword&quot;\r\nDBNAME=&quot;vtest&quot;\r\nSCHEMANAME=&quot;tpc_ds&quot;\r\nDATAFILEPATH=&quot;\/home\/dbadmin\/vertica_stuff\/TPC_DS_Data\/100GB\/*.dat&quot;\r\nSQLFILEPATH=&quot;\/home\/dbadmin\/vertica_stuff\/TPC_DS_SQL\/create_pgsql_tables.sql&quot;\r\n\r\n\/opt\/vertica\/bin\/vsql -f &quot;$SQLFILEPATH&quot; -U dbadmin -w $VPASS -d $DBNAME\r\nfor file in $DATAFILEPATH\r\ndo\r\n    filename=$(basename &quot;$file&quot;)\r\n    tblname=$(basename &quot;$file&quot; | cut -f 1 -d '.')\r\n    echo &quot;Loading file &quot;$filename&quot; into a Vertica host...&quot;\r\n    #single node only:\r\n    echo &quot;COPY $SCHEMANAME.$tblname FROM LOCAL '\/home\/dbadmin\/vertica_stuff\/TPC_DS_Data\/100GB\/$filename' \\\r\n        DELIMITER '|' DIRECT;&quot; | \\\r\n         \/opt\/vertica\/bin\/vsql \\\r\n         -U dbadmin \\\r\n         -w $VPASS \\\r\n         -d $DBNAME\r\ndone\r\n<\/pre>\n<p class=\"Standard\" style=\"text-align: justify;\">The sql file with all the DDL statements for tables\u2019 creation can be downloaded from my OneDrive folder <a href=\"https:\/\/1drv.ms\/f\/s!AuEyKKgH71pxg9lSxhYQmPPQ-YvCjA\" target=\"_blank\" rel=\"noopener\">HERE<\/a>. The script loaded the data using DIRECT option thus straight into ROS (Read Optimised Store) to avoid engaging the Tuple Mover &#8211; database optimiser component that moves data from memory (WOS) to disk (ROS). The load times (1000 Mbps Ethernet), along with some other supporting information, for each of the three datasets are listed below.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Single_Node_Cluster.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3475\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Single_Node_Cluster.png\" alt=\"\" width=\"580\" height=\"122\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Single_Node_Cluster.png 692w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Single_Node_Cluster-300x63.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Three_Node_Cluster.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3476\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Three_Node_Cluster.png\" alt=\"\" width=\"580\" height=\"138\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Three_Node_Cluster.png 692w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_Cluster_Approx_Load_Stats_Three_Node_Cluster-300x72.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<h3 style=\"text-align: center;\">Testing Methodology and Results<\/h3>\n<p class=\"Standard\" style=\"text-align: justify;\">A full TPC-DS benchmark is comprised of 99 queries and governed by very specific set of rules. For brevity, this demo only includes 20 queries i.e. (query number 5, 9, 10, 13, 17, 24, 31, 33, 34, 35, 44, 46, 47, 54, 57, 64, 74, 75, 97 and 99) as a subset sample for two reasons.<\/p>\n<ul>\n<li class=\"Standard\" style=\"text-align: justify;\">The hardware, database setup, data volumes etc. analysed does not follow the characteristics and requirements outline by the TPC organisation and under these circumstances would be considered an &#8216;unacceptable consideration&#8217;. For example, a typical benchmark submitted by a vendor needs to include a number of metrics beyond query throughput e.g. a price-performance ratio, data load times, the availability date of the complete configuration etc. The following is a sample of a compliant reporting of TPC-DS results: &#8216;At 10GB the RALF\/3000 Server has a TPC-DS Query-per-Hour metric of 3010 when run against a 10GB database yielding a TPC-DS Price\/Performance of $1,202 per query-per-hour and will be available 1-Apr-06&#8217;. As this demo and the results below go only skin-deep i.e. query execution times, as previously stated, are only indicative of the performance level in the context of the same data and configuration used, enterprise-ready deployment would yield different (better) results.<\/li>\n<li style=\"text-align: justify;\">As this post is just for fun more than science, running 20 queries seems adequate enough to gauge the performance level dichotomies between the single and the multi-cluster environments.<\/li>\n<\/ul>\n<p class=\"Standard\" style=\"text-align: justify;\">Also, it is worth mentioning that no performance optimisation (database or OS level) was performed on the system. Vertica allows its administrator(s) to fine-tune various aspects of its operation through mechanisms such as statistics update, table partitioning, creating query or workload-specific projections, tuning execution plans etc. Some of those techniques require a deep knowledge of Vertica&#8217;s query execution engine while others can be achieved with little effort e.g. running\u00a0 DBD (Database Designer) &#8211; a GUI based tool which analyses the logical schema definition, sample data, and sample queries, and creates a physical schema\u00a0in the form of a SQL script that you deploy automatically. While the initial scope of this series was intended to compare queries execution times across both versions (tuned and untuned), given the fact that Vertica&#8217;s is purposefully suited to run on a cluster of hosts, I decided to focus on contrasting single vs multi-node cluster deployment instead. Therefore, the results are only indicative of the performance level in the context of the same data and configuration used, with a good chance that further tuning, tweaking or other optimisation techniques would have yielded a much better performance outcomes.<\/p>\n<p class=\"Standard\" style=\"text-align: justify;\">OK, now with this little declaimer out of the way let\u2019s look at how the first ten queries performed across the two distinct setups i.e. single node cluster and multi-node (3 nodes) cluster. Additional queries&#8217; results as well as a quick look at a Tableau and PowerBI performance please refer to <a href=\"http:\/\/bicortex.com\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-4\/\" target=\"_blank\" rel=\"noopener\">Part 4<\/a> of this series.<\/p>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_5_Performance-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3480\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_5_Performance-1.png\" alt=\"\" width=\"580\" height=\"367\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_5_Performance-1.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_5_Performance-1-300x190.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 5 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 5 SQL\">\r\n--Query 5\r\nWITH ssr AS\r\n(\r\n         SELECT   s_store_id,\r\n                  Sum(sales_price) AS sales,\r\n                  Sum(profit)      AS profit,\r\n                  Sum(return_amt)  AS returns1,\r\n                  Sum(net_loss)    AS profit_loss\r\n         FROM     (\r\n                         SELECT ss_store_sk             AS store_sk,\r\n                                ss_sold_date_sk         AS date_sk,\r\n                                ss_ext_sales_price      AS sales_price,\r\n                                ss_net_profit           AS profit,\r\n                                Cast(0 AS DECIMAL(7,2)) AS return_amt,\r\n                                Cast(0 AS DECIMAL(7,2)) AS net_loss\r\n                         FROM   tpc_ds.store_sales\r\n                         UNION ALL\r\n                         SELECT sr_store_sk             AS store_sk,\r\n                                sr_returned_date_sk     AS date_sk,\r\n                                Cast(0 AS DECIMAL(7,2)) AS sales_price,\r\n                                Cast(0 AS DECIMAL(7,2)) AS profit,\r\n                                sr_return_amt           AS return_amt,\r\n                                sr_net_loss             AS net_loss\r\n                         FROM   tpc_ds.store_returns ) salesreturns,\r\n                  tpc_ds.date_dim,\r\n                  tpc_ds.store\r\n         WHERE    date_sk = d_date_sk\r\n         AND      d_date BETWEEN Cast('2002-08-22' AS DATE) AND      (\r\n                           Cast('2002-08-22' AS DATE) + INTERVAL '14' day)\r\n         AND      store_sk = s_store_sk\r\n         GROUP BY s_store_id) , csr AS\r\n(\r\n         SELECT   cp_catalog_page_id,\r\n                  sum(sales_price) AS sales,\r\n                  sum(profit)      AS profit,\r\n                  sum(return_amt)  AS returns1,\r\n                  sum(net_loss)    AS profit_loss\r\n         FROM     (\r\n                         SELECT cs_catalog_page_sk      AS page_sk,\r\n                                cs_sold_date_sk         AS date_sk,\r\n                                cs_ext_sales_price      AS sales_price,\r\n                                cs_net_profit           AS profit,\r\n                                cast(0 AS decimal(7,2)) AS return_amt,\r\n                                cast(0 AS decimal(7,2)) AS net_loss\r\n                         FROM   tpc_ds.catalog_sales\r\n                         UNION ALL\r\n                         SELECT cr_catalog_page_sk      AS page_sk,\r\n                                cr_returned_date_sk     AS date_sk,\r\n                                cast(0 AS decimal(7,2)) AS sales_price,\r\n                                cast(0 AS decimal(7,2)) AS profit,\r\n                                cr_return_amount        AS return_amt,\r\n                                cr_net_loss             AS net_loss\r\n                         FROM   tpc_ds.catalog_returns ) salesreturns,\r\n                  tpc_ds.date_dim,\r\n                  tpc_ds.catalog_page\r\n         WHERE    date_sk = d_date_sk\r\n         AND      d_date BETWEEN cast('2002-08-22' AS date) AND      (\r\n                           cast('2002-08-22' AS date) + INTERVAL '14' day)\r\n         AND      page_sk = cp_catalog_page_sk\r\n         GROUP BY cp_catalog_page_id) , wsr AS\r\n(\r\n         SELECT   web_site_id,\r\n                  sum(sales_price) AS sales,\r\n                  sum(profit)      AS profit,\r\n                  sum(return_amt)  AS returns1,\r\n                  sum(net_loss)    AS profit_loss\r\n         FROM     (\r\n                         SELECT ws_web_site_sk          AS wsr_web_site_sk,\r\n                                ws_sold_date_sk         AS date_sk,\r\n                                ws_ext_sales_price      AS sales_price,\r\n                                ws_net_profit           AS profit,\r\n                                cast(0 AS decimal(7,2)) AS return_amt,\r\n                                cast(0 AS decimal(7,2)) AS net_loss\r\n                         FROM   tpc_ds.web_sales\r\n                         UNION ALL\r\n                         SELECT          ws_web_site_sk          AS wsr_web_site_sk,\r\n                                         wr_returned_date_sk     AS date_sk,\r\n                                         cast(0 AS decimal(7,2)) AS sales_price,\r\n                                         cast(0 AS decimal(7,2)) AS profit,\r\n                                         wr_return_amt           AS return_amt,\r\n                                         wr_net_loss             AS net_loss\r\n                         FROM            tpc_ds.web_returns\r\n                         LEFT OUTER JOIN tpc_ds.web_sales\r\n                         ON              (\r\n                                                         wr_item_sk = ws_item_sk\r\n                                         AND             wr_order_number = ws_order_number) ) salesreturns,\r\n                  tpc_ds.date_dim,\r\n                  tpc_ds.web_site\r\n         WHERE    date_sk = d_date_sk\r\n         AND      d_date BETWEEN cast('2002-08-22' AS date) AND      (\r\n                           cast('2002-08-22' AS date) + INTERVAL '14' day)\r\n         AND      wsr_web_site_sk = web_site_sk\r\n         GROUP BY web_site_id)\r\nSELECT\r\n         channel ,\r\n         id ,\r\n         sum(sales)   AS sales ,\r\n         sum(returns1) AS returns1 ,\r\n         sum(profit)  AS profit\r\nFROM     (\r\n                SELECT 'store channel' AS channel ,\r\n                       'store'\r\n                              || s_store_id AS id ,\r\n                       sales ,\r\n                       returns1 ,\r\n                       (profit - profit_loss) AS profit\r\n                FROM   ssr\r\n                UNION ALL\r\n                SELECT 'catalog channel' AS channel ,\r\n                       'catalog_page'\r\n                              || cp_catalog_page_id AS id ,\r\n                       sales ,\r\n                       returns1 ,\r\n                       (profit - profit_loss) AS profit\r\n                FROM   csr\r\n                UNION ALL\r\n                SELECT 'web channel' AS channel ,\r\n                       'web_site'\r\n                              || web_site_id AS id ,\r\n                       sales ,\r\n                       returns1 ,\r\n                       (profit - profit_loss) AS profit\r\n                FROM   wsr ) x\r\nGROUP BY rollup (channel, id)\r\nORDER BY channel ,\r\n         id\r\nLIMIT 100;\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_9_Performance-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3481\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_9_Performance-1.png\" alt=\"\" width=\"581\" height=\"362\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_9_Performance-1.png 581w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_9_Performance-1-300x187.png 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 9 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 9 SQL\">\r\n--Query 9\r\nSELECT CASE\r\n         WHEN (SELECT Count(*)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 1 AND 20) &amp;amp;gt; 3672 THEN\r\n         (SELECT Avg(ss_ext_list_price)\r\n          FROM   tpc_ds.store_sales\r\n          WHERE\r\n         ss_quantity BETWEEN 1 AND 20)\r\n         ELSE (SELECT Avg(ss_net_profit)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 1 AND 20)\r\n       END bucket1,\r\n       CASE\r\n         WHEN (SELECT Count(*)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 21 AND 40) &amp;amp;gt; 3392 THEN\r\n         (SELECT Avg(ss_ext_list_price)\r\n          FROM   tpc_ds.store_sales\r\n          WHERE\r\n         ss_quantity BETWEEN 21 AND 40)\r\n         ELSE (SELECT Avg(ss_net_profit)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 21 AND 40)\r\n       END bucket2,\r\n       CASE\r\n         WHEN (SELECT Count(*)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 41 AND 60) &amp;amp;gt; 32784 THEN\r\n         (SELECT Avg(ss_ext_list_price)\r\n          FROM   tpc_ds.store_sales\r\n          WHERE\r\n         ss_quantity BETWEEN 41 AND 60)\r\n         ELSE (SELECT Avg(ss_net_profit)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 41 AND 60)\r\n       END bucket3,\r\n       CASE\r\n         WHEN (SELECT Count(*)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 61 AND 80) &amp;amp;gt; 26032 THEN\r\n         (SELECT Avg(ss_ext_list_price)\r\n          FROM   tpc_ds.store_sales\r\n          WHERE\r\n         ss_quantity BETWEEN 61 AND 80)\r\n         ELSE (SELECT Avg(ss_net_profit)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 61 AND 80)\r\n       END bucket4,\r\n       CASE\r\n         WHEN (SELECT Count(*)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 81 AND 100) &amp;amp;gt; 23982 THEN\r\n         (SELECT Avg(ss_ext_list_price)\r\n          FROM   tpc_ds.store_sales\r\n          WHERE\r\n         ss_quantity BETWEEN 81 AND 100)\r\n         ELSE (SELECT Avg(ss_net_profit)\r\n               FROM   tpc_ds.store_sales\r\n               WHERE  ss_quantity BETWEEN 81 AND 100)\r\n       END bucket5\r\nFROM   tpc_ds.reason\r\nWHERE  r_reason_sk = 1;\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_10_Performance-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3482\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_10_Performance-1.png\" alt=\"\" width=\"580\" height=\"383\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_10_Performance-1.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_10_Performance-1-300x198.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 10 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 10 SQL\">\r\n--Query 10\r\nSELECT cd_gender,\r\n               cd_marital_status,\r\n               cd_education_status,\r\n               Count(*) cnt1,\r\n               cd_purchase_estimate,\r\n               Count(*) cnt2,\r\n               cd_credit_rating,\r\n               Count(*) cnt3,\r\n               cd_dep_count,\r\n               Count(*) cnt4,\r\n               cd_dep_employed_count,\r\n               Count(*) cnt5,\r\n               cd_dep_college_count,\r\n               Count(*) cnt6\r\nFROM   tpc_ds.customer c,\r\n       tpc_ds.customer_address ca,\r\n       tpc_ds.customer_demographics\r\nWHERE  c.c_current_addr_sk = ca.ca_address_sk\r\n       AND ca_county IN ( 'Lycoming County', 'Sheridan County',\r\n                          'Kandiyohi County',\r\n                          'Pike County',\r\n                                           'Greene County' )\r\n       AND cd_demo_sk = c.c_current_cdemo_sk\r\n       AND EXISTS (SELECT *\r\n                   FROM   tpc_ds.store_sales,\r\n                          tpc_ds.date_dim\r\n                   WHERE  c.c_customer_sk = ss_customer_sk\r\n                          AND ss_sold_date_sk = d_date_sk\r\n                          AND d_year = 2002\r\n                          AND d_moy BETWEEN 4 AND 4 + 3)\r\n       AND ( EXISTS (SELECT *\r\n                     FROM   tpc_ds.web_sales,\r\n                            tpc_ds.date_dim\r\n                     WHERE  c.c_customer_sk = ws_bill_customer_sk\r\n                            AND ws_sold_date_sk = d_date_sk\r\n                            AND d_year = 2002\r\n                            AND d_moy BETWEEN 4 AND 4 + 3)\r\n              OR EXISTS (SELECT *\r\n                         FROM   tpc_ds.catalog_sales,\r\n                                tpc_ds.date_dim\r\n                         WHERE  c.c_customer_sk = cs_ship_customer_sk\r\n                                AND cs_sold_date_sk = d_date_sk\r\n                                AND d_year = 2002\r\n                                AND d_moy BETWEEN 4 AND 4 + 3) )\r\nGROUP  BY cd_gender,\r\n          cd_marital_status,\r\n          cd_education_status,\r\n          cd_purchase_estimate,\r\n          cd_credit_rating,\r\n          cd_dep_count,\r\n          cd_dep_employed_count,\r\n          cd_dep_college_count\r\nORDER  BY cd_gender,\r\n          cd_marital_status,\r\n          cd_education_status,\r\n          cd_purchase_estimate,\r\n          cd_credit_rating,\r\n          cd_dep_count,\r\n          cd_dep_employed_count,\r\n          cd_dep_college_count\r\nLIMIT 100;\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_13_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3485\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_13_Performance.png\" alt=\"\" width=\"580\" height=\"381\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_13_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_13_Performance-300x197.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 13 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 13 SQL\">\r\n--Query 13\r\nSELECT Avg(ss_quantity),\r\n       Avg(ss_ext_sales_price),\r\n       Avg(ss_ext_wholesale_cost),\r\n       Sum(ss_ext_wholesale_cost)\r\nFROM   tpc_ds.store_sales,\r\n       tpc_ds.store,\r\n       tpc_ds.customer_demographics,\r\n       tpc_ds.household_demographics,\r\n       tpc_ds.customer_address,\r\n       tpc_ds.date_dim\r\nWHERE  s_store_sk = ss_store_sk\r\n       AND ss_sold_date_sk = d_date_sk\r\n       AND d_year = 2001\r\n       AND ( ( ss_hdemo_sk = hd_demo_sk\r\n               AND cd_demo_sk = ss_cdemo_sk\r\n               AND cd_marital_status = 'U'\r\n               AND cd_education_status = 'Advanced Degree'\r\n               AND ss_sales_price BETWEEN 100.00 AND 150.00\r\n               AND hd_dep_count = 3 )\r\n              OR ( ss_hdemo_sk = hd_demo_sk\r\n                   AND cd_demo_sk = ss_cdemo_sk\r\n                   AND cd_marital_status = 'M'\r\n                   AND cd_education_status = 'Primary'\r\n                   AND ss_sales_price BETWEEN 50.00 AND 100.00\r\n                   AND hd_dep_count = 1 )\r\n              OR ( ss_hdemo_sk = hd_demo_sk\r\n                   AND cd_demo_sk = ss_cdemo_sk\r\n                   AND cd_marital_status = 'D'\r\n                   AND cd_education_status = 'Secondary'\r\n                   AND ss_sales_price BETWEEN 150.00 AND 200.00\r\n                   AND hd_dep_count = 1 ) )\r\n       AND ( ( ss_addr_sk = ca_address_sk\r\n               AND ca_country = 'United States'\r\n               AND ca_state IN ( 'AZ', 'NE', 'IA' )\r\n               AND ss_net_profit BETWEEN 100 AND 200 )\r\n              OR ( ss_addr_sk = ca_address_sk\r\n                   AND ca_country = 'United States'\r\n                   AND ca_state IN ( 'MS', 'CA', 'NV' )\r\n                   AND ss_net_profit BETWEEN 150 AND 300 )\r\n              OR ( ss_addr_sk = ca_address_sk\r\n                   AND ca_country = 'United States'\r\n                   AND ca_state IN ( 'GA', 'TX', 'NJ' )\r\n                   AND ss_net_profit BETWEEN 50 AND 250 ) );\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_17_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3486\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_17_Performance.png\" alt=\"\" width=\"580\" height=\"366\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_17_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_17_Performance-300x189.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 17 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 17 SQL\">\r\n--Query 17\r\nSELECT i_item_id,\r\n               i_item_desc,\r\n               s_state,\r\n               Count(ss_quantity)                                        AS\r\n               store_sales_quantitycount,\r\n               Avg(ss_quantity)                                          AS\r\n               store_sales_quantityave,\r\n               Stddev_samp(ss_quantity)                                  AS\r\n               store_sales_quantitystdev,\r\n               Stddev_samp(ss_quantity) \/ Avg(ss_quantity)               AS\r\n               store_sales_quantitycov,\r\n               Count(sr_return_quantity)                                 AS\r\n               store_returns_quantitycount,\r\n               Avg(sr_return_quantity)                                   AS\r\n               store_returns_quantityave,\r\n               Stddev_samp(sr_return_quantity)                           AS\r\n               store_returns_quantitystdev,\r\n               Stddev_samp(sr_return_quantity) \/ Avg(sr_return_quantity) AS\r\n               store_returns_quantitycov,\r\n               Count(cs_quantity)                                        AS\r\n               catalog_sales_quantitycount,\r\n               Avg(cs_quantity)                                          AS\r\n               catalog_sales_quantityave,\r\n               Stddev_samp(cs_quantity) \/ Avg(cs_quantity)               AS\r\n               catalog_sales_quantitystdev,\r\n               Stddev_samp(cs_quantity) \/ Avg(cs_quantity)               AS\r\n               catalog_sales_quantitycov\r\nFROM   tpc_ds.store_sales,\r\n       tpc_ds.store_returns,\r\n       tpc_ds.catalog_sales,\r\n       tpc_ds.date_dim d1,\r\n       tpc_ds.date_dim d2,\r\n       tpc_ds.date_dim d3,\r\n       tpc_ds.store,\r\n       tpc_ds.item\r\nWHERE  d1.d_quarter_name = '1999Q1'\r\n       AND d1.d_date_sk = ss_sold_date_sk\r\n       AND i_item_sk = ss_item_sk\r\n       AND s_store_sk = ss_store_sk\r\n       AND ss_customer_sk = sr_customer_sk\r\n       AND ss_item_sk = sr_item_sk\r\n       AND ss_ticket_number = sr_ticket_number\r\n       AND sr_returned_date_sk = d2.d_date_sk\r\n       AND d2.d_quarter_name IN ( '1999Q1', '1999Q2', '1999Q3' )\r\n       AND sr_customer_sk = cs_bill_customer_sk\r\n       AND sr_item_sk = cs_item_sk\r\n       AND cs_sold_date_sk = d3.d_date_sk\r\n       AND d3.d_quarter_name IN ( '1999Q1', '1999Q2', '1999Q3' )\r\nGROUP  BY i_item_id,\r\n          i_item_desc,\r\n          s_state\r\nORDER  BY i_item_id,\r\n          i_item_desc,\r\n          s_state\r\nLIMIT 100;\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_24_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3487\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_24_Performance.png\" alt=\"\" width=\"580\" height=\"492\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_24_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_24_Performance-300x254.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 24 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 24 SQL\">\r\n--Query 24\r\nWITH ssales \r\n     AS (SELECT c_last_name, \r\n                c_first_name, \r\n                s_store_name, \r\n                ca_state, \r\n                s_state, \r\n                i_color, \r\n                i_current_price, \r\n                i_manager_id, \r\n                i_units, \r\n                i_size, \r\n                Sum(ss_net_profit) netpaid \r\n         FROM   tpc_ds.store_sales,\r\n                tpc_ds.store_returns,\r\n                tpc_ds.store,\r\n                tpc_ds.item,\r\n                tpc_ds.customer,\r\n                tpc_ds.customer_address\r\n         WHERE  ss_ticket_number = sr_ticket_number \r\n                AND ss_item_sk = sr_item_sk \r\n                AND ss_customer_sk = c_customer_sk \r\n                AND ss_item_sk = i_item_sk \r\n                AND ss_store_sk = s_store_sk \r\n                AND c_birth_country = Upper(ca_country) \r\n                AND s_zip = ca_zip \r\n                AND s_market_id = 6 \r\n         GROUP  BY c_last_name, \r\n                   c_first_name, \r\n                   s_store_name, \r\n                   ca_state, \r\n                   s_state, \r\n                   i_color, \r\n                   i_current_price, \r\n                   i_manager_id, \r\n                   i_units, \r\n                   i_size) \r\nSELECT c_last_name, \r\n       c_first_name, \r\n       s_store_name, \r\n       Sum(netpaid) paid \r\nFROM   ssales \r\nWHERE  i_color = 'papaya' \r\nGROUP  BY c_last_name, \r\n          c_first_name, \r\n          s_store_name \r\nHAVING Sum(netpaid) &gt; (SELECT 0.05 * Avg(netpaid) \r\n                       FROM   ssales); \r\n\r\nWITH ssales \r\n     AS (SELECT c_last_name, \r\n                c_first_name, \r\n                s_store_name, \r\n                ca_state, \r\n                s_state, \r\n                i_color, \r\n                i_current_price, \r\n                i_manager_id, \r\n                i_units, \r\n                i_size, \r\n                Sum(ss_net_profit) netpaid \r\n         FROM   tpc_ds.store_sales,\r\n                tpc_ds.store_returns,\r\n                tpc_ds.store,\r\n                tpc_ds.item,\r\n                tpc_ds.customer,\r\n                tpc_ds.customer_address\r\n         WHERE  ss_ticket_number = sr_ticket_number \r\n                AND ss_item_sk = sr_item_sk \r\n                AND ss_customer_sk = c_customer_sk \r\n                AND ss_item_sk = i_item_sk \r\n                AND ss_store_sk = s_store_sk \r\n                AND c_birth_country = Upper(ca_country) \r\n                AND s_zip = ca_zip \r\n                AND s_market_id = 6 \r\n         GROUP  BY c_last_name, \r\n                   c_first_name, \r\n                   s_store_name, \r\n                   ca_state, \r\n                   s_state, \r\n                   i_color, \r\n                   i_current_price, \r\n                   i_manager_id, \r\n                   i_units, \r\n                   i_size) \r\nSELECT c_last_name, \r\n       c_first_name, \r\n       s_store_name, \r\n       Sum(netpaid) paid \r\nFROM   ssales \r\nWHERE  i_color = 'chartreuse' \r\nGROUP  BY c_last_name, \r\n          c_first_name, \r\n          s_store_name \r\nHAVING Sum(netpaid) &gt; (SELECT 0.05 * Avg(netpaid) \r\n                       FROM   ssales); \r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_31_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3488\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_31_Performance.png\" alt=\"\" width=\"580\" height=\"357\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_31_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_31_Performance-300x185.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 31 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 31 SQL\">\r\n--Query 31\r\nWITH ss\r\n     AS (SELECT ca_county,\r\n                d_qoy,\r\n                d_year,\r\n                Sum(ss_ext_sales_price) AS store_sales\r\n         FROM   tpc_ds.store_sales,\r\n                tpc_ds.date_dim,\r\n                tpc_ds.customer_address\r\n         WHERE  ss_sold_date_sk = d_date_sk\r\n                AND ss_addr_sk = ca_address_sk\r\n         GROUP  BY ca_county,\r\n                   d_qoy,\r\n                   d_year),\r\n     ws\r\n     AS (SELECT ca_county,\r\n                d_qoy,\r\n                d_year,\r\n                Sum(ws_ext_sales_price) AS web_sales\r\n         FROM   tpc_ds.web_sales,\r\n                tpc_ds.date_dim,\r\n                tpc_ds.customer_address\r\n         WHERE  ws_sold_date_sk = d_date_sk\r\n                AND ws_bill_addr_sk = ca_address_sk\r\n         GROUP  BY ca_county,\r\n                   d_qoy,\r\n                   d_year)\r\nSELECT ss1.ca_county,\r\n       ss1.d_year,\r\n       ws2.web_sales \/ ws1.web_sales     web_q1_q2_increase,\r\n       ss2.store_sales \/ ss1.store_sales store_q1_q2_increase,\r\n       ws3.web_sales \/ ws2.web_sales     web_q2_q3_increase,\r\n       ss3.store_sales \/ ss2.store_sales store_q2_q3_increase\r\nFROM   ss ss1,\r\n       ss ss2,\r\n       ss ss3,\r\n       ws ws1,\r\n       ws ws2,\r\n       ws ws3\r\nWHERE  ss1.d_qoy = 1\r\n       AND ss1.d_year = 2001\r\n       AND ss1.ca_county = ss2.ca_county\r\n       AND ss2.d_qoy = 2\r\n       AND ss2.d_year = 2001\r\n       AND ss2.ca_county = ss3.ca_county\r\n       AND ss3.d_qoy = 3\r\n       AND ss3.d_year = 2001\r\n       AND ss1.ca_county = ws1.ca_county\r\n       AND ws1.d_qoy = 1\r\n       AND ws1.d_year = 2001\r\n       AND ws1.ca_county = ws2.ca_county\r\n       AND ws2.d_qoy = 2\r\n       AND ws2.d_year = 2001\r\n       AND ws1.ca_county = ws3.ca_county\r\n       AND ws3.d_qoy = 3\r\n       AND ws3.d_year = 2001\r\n       AND CASE\r\n             WHEN ws1.web_sales &gt; 0 THEN ws2.web_sales \/ ws1.web_sales\r\n             ELSE NULL\r\n           END &gt; CASE\r\n                   WHEN ss1.store_sales &gt; 0 THEN\r\n                   ss2.store_sales \/ ss1.store_sales\r\n                   ELSE NULL\r\n                 END\r\n       AND CASE\r\n             WHEN ws2.web_sales &gt; 0 THEN ws3.web_sales \/ ws2.web_sales\r\n             ELSE NULL\r\n           END &gt; CASE\r\n                   WHEN ss2.store_sales &gt; 0 THEN\r\n                   ss3.store_sales \/ ss2.store_sales\r\n                   ELSE NULL\r\n                 END\r\nORDER  BY ss1.d_year;\t\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_33_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3489\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_33_Performance.png\" alt=\"\" width=\"580\" height=\"362\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_33_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_33_Performance-300x187.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 33 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 33 SQL\">\r\n--Query 33\r\nWITH ss\r\n     AS (SELECT i_manufact_id,\r\n                Sum(ss_ext_sales_price) total_sales\r\n         FROM   tpc_ds.store_sales,\r\n                tpc_ds.date_dim,\r\n                tpc_ds.customer_address,\r\n                tpc_ds.item\r\n         WHERE  i_manufact_id IN (SELECT i_manufact_id\r\n                                  FROM   tpc_ds.item\r\n                                  WHERE  i_category IN ( 'Books' ))\r\n                AND ss_item_sk = i_item_sk\r\n                AND ss_sold_date_sk = d_date_sk\r\n                AND d_year = 1999\r\n                AND d_moy = 3\r\n                AND ss_addr_sk = ca_address_sk\r\n                AND ca_gmt_offset = -5\r\n         GROUP  BY i_manufact_id),\r\n     cs\r\n     AS (SELECT i_manufact_id,\r\n                Sum(cs_ext_sales_price) total_sales\r\n         FROM   tpc_ds.catalog_sales,\r\n                tpc_ds.date_dim,\r\n                tpc_ds.customer_address,\r\n                tpc_ds.item\r\n         WHERE  i_manufact_id IN (SELECT i_manufact_id\r\n                                  FROM   tpc_ds.item\r\n                                  WHERE  i_category IN ( 'Books' ))\r\n                AND cs_item_sk = i_item_sk\r\n                AND cs_sold_date_sk = d_date_sk\r\n                AND d_year = 1999\r\n                AND d_moy = 3\r\n                AND cs_bill_addr_sk = ca_address_sk\r\n                AND ca_gmt_offset = -5\r\n         GROUP  BY i_manufact_id),\r\n     ws\r\n     AS (SELECT i_manufact_id,\r\n                Sum(ws_ext_sales_price) total_sales\r\n         FROM   tpc_ds.web_sales,\r\n                tpc_ds.date_dim,\r\n                tpc_ds.customer_address,\r\n                tpc_ds.item\r\n         WHERE  i_manufact_id IN (SELECT i_manufact_id\r\n                                  FROM   tpc_ds.item\r\n                                  WHERE  i_category IN ( 'Books' ))\r\n                AND ws_item_sk = i_item_sk\r\n                AND ws_sold_date_sk = d_date_sk\r\n                AND d_year = 1999\r\n                AND d_moy = 3\r\n                AND ws_bill_addr_sk = ca_address_sk\r\n                AND ca_gmt_offset = -5\r\n         GROUP  BY i_manufact_id)\r\nSELECT i_manufact_id,\r\n               Sum(total_sales) total_sales\r\nFROM   (SELECT *\r\n        FROM   ss\r\n        UNION ALL\r\n        SELECT *\r\n        FROM   cs\r\n        UNION ALL\r\n        SELECT *\r\n        FROM   ws) tmp1\r\nGROUP  BY i_manufact_id\r\nORDER  BY total_sales\r\nLIMIT 100;\r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_34_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3490\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_34_Performance.png\" alt=\"\" width=\"580\" height=\"364\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_34_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_34_Performance-300x188.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 34 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 34 SQL\">\r\n--Query 34\r\nSELECT c_last_name, \r\n       c_first_name, \r\n       c_salutation, \r\n       c_preferred_cust_flag, \r\n       ss_ticket_number, \r\n       cnt \r\nFROM   (SELECT ss_ticket_number, \r\n               ss_customer_sk, \r\n               Count(*) cnt \r\n        FROM   tpc_ds.store_sales,\r\n               tpc_ds.date_dim,\r\n               tpc_ds.store,\r\n               tpc_ds.household_demographics\r\n        WHERE  store_sales.ss_sold_date_sk = date_dim.d_date_sk \r\n               AND store_sales.ss_store_sk = store.s_store_sk \r\n               AND store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk \r\n               AND ( date_dim.d_dom BETWEEN 1 AND 3 \r\n                      OR date_dim.d_dom BETWEEN 25 AND 28 ) \r\n               AND ( household_demographics.hd_buy_potential = '&gt;10000' \r\n                      OR household_demographics.hd_buy_potential = 'unknown' ) \r\n               AND household_demographics.hd_vehicle_count &gt; 0 \r\n               AND ( CASE \r\n                       WHEN household_demographics.hd_vehicle_count &gt; 0 THEN \r\n                       household_demographics.hd_dep_count \/ \r\n                       household_demographics.hd_vehicle_count \r\n                       ELSE NULL \r\n                     END ) &gt; 1.2 \r\n               AND date_dim.d_year IN ( 1999, 1999 + 1, 1999 + 2 ) \r\n               AND store.s_county IN ( 'Williamson County', 'Williamson County', \r\n                                       'Williamson County', \r\n                                                             'Williamson County' \r\n                                       , \r\n                                       'Williamson County', 'Williamson County', \r\n                                           'Williamson County', \r\n                                                             'Williamson County' \r\n                                     ) \r\n        GROUP  BY ss_ticket_number, \r\n                  ss_customer_sk) dn, \r\n       tpc_ds.customer\r\nWHERE  ss_customer_sk = c_customer_sk \r\n       AND cnt BETWEEN 15 AND 20 \r\nORDER  BY c_last_name, \r\n          c_first_name, \r\n          c_salutation, \r\n          c_preferred_cust_flag DESC; \r\n<\/pre>\n<p><a href=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_35_Performance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3491\" src=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/\/2018\/06\/Vertica_TPCDS_Query_35_Performance.png\" alt=\"\" width=\"580\" height=\"445\" srcset=\"http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_35_Performance.png 580w, http:\/\/bicortex.com\/bicortex\/wp-content\/post_content\/2018\/06\/Vertica_TPCDS_Query_35_Performance-300x230.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<pre class=\"brush: sql; collapse: true; light: false; title: (+) Expand Source for Query 35 SQL; toolbar: true; notranslate\" title=\"(+) Expand Source for Query 35 SQL\">\r\n--Query 35\r\nSELECT ca_state,\r\n               cd_gender,\r\n               cd_marital_status,\r\n               cd_dep_count,\r\n               Count(*) cnt1,\r\n               Stddev_samp(cd_dep_count),\r\n               Avg(cd_dep_count),\r\n               Max(cd_dep_count),\r\n               cd_dep_employed_count,\r\n               Count(*) cnt2,\r\n               Stddev_samp(cd_dep_employed_count),\r\n               Avg(cd_dep_employed_count),\r\n               Max(cd_dep_employed_count),\r\n               cd_dep_college_count,\r\n               Count(*) cnt3,\r\n               Stddev_samp(cd_dep_college_count),\r\n               Avg(cd_dep_college_count),\r\n               Max(cd_dep_college_count)\r\nFROM   tpc_ds.customer c,\r\n       tpc_ds.customer_address ca,\r\n       tpc_ds.customer_demographics\r\nWHERE  c.c_current_addr_sk = ca.ca_address_sk\r\n       AND cd_demo_sk = c.c_current_cdemo_sk\r\n       AND EXISTS (SELECT *\r\n                   FROM   tpc_ds.store_sales,\r\n                          tpc_ds.date_dim\r\n                   WHERE  c.c_customer_sk = ss_customer_sk\r\n                          AND ss_sold_date_sk = d_date_sk\r\n                          AND d_year = 2001\r\n                          AND d_qoy &lt; 4)\r\n       AND ( EXISTS (SELECT *\r\n                     FROM   tpc_ds.web_sales,\r\n                            tpc_ds.date_dim\r\n                     WHERE  c.c_customer_sk = ws_bill_customer_sk\r\n                            AND ws_sold_date_sk = d_date_sk\r\n                            AND d_year = 2001\r\n                            AND d_qoy &lt; 4)\r\n              OR EXISTS (SELECT *\r\n                         FROM   tpc_ds.catalog_sales,\r\n                                tpc_ds.date_dim\r\n                         WHERE  c.c_customer_sk = cs_ship_customer_sk\r\n                                AND cs_sold_date_sk = d_date_sk\r\n                                AND d_year = 2001\r\n                                AND d_qoy &lt; 4) )\r\nGROUP  BY ca_state,\r\n          cd_gender,\r\n          cd_marital_status,\r\n          cd_dep_count,\r\n          cd_dep_employed_count,\r\n          cd_dep_college_count\r\nORDER  BY ca_state,\r\n          cd_gender,\r\n          cd_marital_status,\r\n          cd_dep_count,\r\n          cd_dep_employed_count,\r\n          cd_dep_college_count\r\nLIMIT 100;\t\t\r\n<\/pre>\n<p class=\"Standard\" style=\"text-align: justify;\">I decided to break up the queries&#8217; performance analysis into two parts. Further TPC-DS queries&#8217; results, along with a quick look at how Vertica plays with Tableau and PowerBI applications, can be viewed in <a href=\"http:\/\/bicortex.com\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-4\/\" target=\"_blank\" rel=\"noopener\">Part 4<\/a> to this series but we can already see the execution pattern and how data volumes and its distribution across multiple nodes impact the performance. Again, please refer to <a href=\"http:\/\/bicortex.com\/vertica-mpp-database-overview-and-tpc-ds-benchmark-performance-analysis-part-4\/\" target=\"_blank\" rel=\"noopener\">Post 4<\/a> for data on the additional ten queries performance results and my final comments on this experiment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Post 1 I outlined the key architectural principles behind Vertica\u2019s design and what makes it one of the top MPP\/analytical databases available today. In Post 2 I went over the installation process across one and multiple nodes as well as some of Vertica\u2019s &#8216;knobs and buttons&#8217; which give the administrator a comprehensive snapshot of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72,5],"tags":[16,14,73,49,74],"class_list":["post-3366","post","type-post","status-publish","format-standard","hentry","category-mpp-rdbms","category-sql","tag-analytics","tag-big-data","tag-mpp-rdbms","tag-sql","tag-vertica"],"aioseo_notices":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/posts\/3366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/comments?post=3366"}],"version-history":[{"count":100,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/posts\/3366\/revisions"}],"predecessor-version":[{"id":3567,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/posts\/3366\/revisions\/3567"}],"wp:attachment":[{"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/media?parent=3366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/categories?post=3366"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bicortex.com\/bicortex\/wp-json\/wp\/v2\/tags?post=3366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}