CINXE.COM
Presto(PrestoDB)- What it Offers and Where and How it can be used – Engineering Blog
<!doctype html> <html lang="en-US"> <head> <script type="text/javascript" src="https://cdn.cookielaw.org/consent/3959dac5-afc8-4ac6-a2c2-f91a2836f1c6/OtAutoBlock.js" ></script> <script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="3959dac5-afc8-4ac6-a2c2-f91a2836f1c6" ></script> <script type="text/javascript"> function OptanonWrapper() { } </script> <meta charset="UTF-8"> <link rel="profile" href="https://gmpg.org/xfn/11"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <title>Presto(PrestoDB)- What it Offers and Where and How it can be used – Engineering Blog</title> <meta name='robots' content='max-image-preview:large' /> <link rel="alternate" type="application/rss+xml" title="Engineering Blog » Feed" href="https://engineering.zeta.tech/feed/" /> <link rel="alternate" type="application/rss+xml" title="Engineering Blog » Comments Feed" href="https://engineering.zeta.tech/comments/feed/" /> <link rel="alternate" type="application/rss+xml" title="Engineering Blog » Presto(PrestoDB)- What it Offers and Where and How it can be used Comments Feed" href="https://engineering.zeta.tech/prestoprestodb-what-it-offers-and-where-and-how-it-can-be-used/feed/" /> <script> window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/15.0.3\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/engineering.zeta.tech\/wp-includes\/js\/wp-emoji-release.min.js?ver=6.6.1"}}; /*! This file is auto-generated */ !function(i,n){var o,s,e;function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),r=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===r[t]})}function u(e,t,n){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\uddfa\ud83c\uddf3","\ud83c\uddfa\u200b\ud83c\uddf3")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!n(e,"\ud83d\udc26\u200d\u2b1b","\ud83d\udc26\u200b\u2b1b")}return!1}function f(e,t,n){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):i.createElement("canvas"),a=r.getContext("2d",{willReadFrequently:!0}),o=(a.textBaseline="top",a.font="600 32px Arial",{});return e.forEach(function(e){o[e]=t(a,e,n)}),o}function t(e){var t=i.createElement("script");t.src=e,t.defer=!0,i.head.appendChild(t)}"undefined"!=typeof Promise&&(o="wpEmojiSettingsSupports",s=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){i.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+f.toString()+"("+[JSON.stringify(s),u.toString(),p.toString()].join(",")+"));",r=new Blob([e],{type:"text/javascript"}),a=new Worker(URL.createObjectURL(r),{name:"wpTestEmojiSupports"});return void(a.onmessage=function(e){c(n=e.data),a.terminate(),t(n)})}catch(e){}c(n=f(s,u,p))}t(n)}).then(function(e){for(var t in e)n.supports[t]=e[t],n.supports.everything=n.supports.everything&&n.supports[t],"flag"!==t&&(n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&n.supports[t]);n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&!n.supports.flag,n.DOMReady=!1,n.readyCallback=function(){n.DOMReady=!0}}).then(function(){return e}).then(function(){var e;n.supports.everything||(n.readyCallback(),(e=n.source||{}).concatemoji?t(e.concatemoji):e.wpemoji&&e.twemoji&&(t(e.twemoji),t(e.wpemoji)))}))}((window,document),window._wpemojiSettings); </script> <style id='wp-emoji-styles-inline-css'> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 0.07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link rel='stylesheet' id='wp-block-library-css' href='https://engineering.zeta.tech/wp-includes/css/dist/block-library/style.min.css?ver=6.6.1' media='all' /> <style id='classic-theme-styles-inline-css'> /*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} </style> <style id='global-styles-inline-css'> :root{--wp--preset--aspect-ratio--square: 1;--wp--preset--aspect-ratio--4-3: 4/3;--wp--preset--aspect-ratio--3-4: 3/4;--wp--preset--aspect-ratio--3-2: 3/2;--wp--preset--aspect-ratio--2-3: 2/3;--wp--preset--aspect-ratio--16-9: 16/9;--wp--preset--aspect-ratio--9-16: 9/16;--wp--preset--color--black: #000000;--wp--preset--color--cyan-bluish-gray: #abb8c3;--wp--preset--color--white: #ffffff;--wp--preset--color--pale-pink: #f78da7;--wp--preset--color--vivid-red: #cf2e2e;--wp--preset--color--luminous-vivid-orange: #ff6900;--wp--preset--color--luminous-vivid-amber: #fcb900;--wp--preset--color--light-green-cyan: #7bdcb5;--wp--preset--color--vivid-green-cyan: #00d084;--wp--preset--color--pale-cyan-blue: #8ed1fc;--wp--preset--color--vivid-cyan-blue: #0693e3;--wp--preset--color--vivid-purple: #9b51e0;--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple: linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%);--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan: linear-gradient(135deg,rgb(122,220,180) 0%,rgb(0,208,130) 100%);--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange: linear-gradient(135deg,rgba(252,185,0,1) 0%,rgba(255,105,0,1) 100%);--wp--preset--gradient--luminous-vivid-orange-to-vivid-red: linear-gradient(135deg,rgba(255,105,0,1) 0%,rgb(207,46,46) 100%);--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray: linear-gradient(135deg,rgb(238,238,238) 0%,rgb(169,184,195) 100%);--wp--preset--gradient--cool-to-warm-spectrum: linear-gradient(135deg,rgb(74,234,220) 0%,rgb(151,120,209) 20%,rgb(207,42,186) 40%,rgb(238,44,130) 60%,rgb(251,105,98) 80%,rgb(254,248,76) 100%);--wp--preset--gradient--blush-light-purple: linear-gradient(135deg,rgb(255,206,236) 0%,rgb(152,150,240) 100%);--wp--preset--gradient--blush-bordeaux: linear-gradient(135deg,rgb(254,205,165) 0%,rgb(254,45,45) 50%,rgb(107,0,62) 100%);--wp--preset--gradient--luminous-dusk: linear-gradient(135deg,rgb(255,203,112) 0%,rgb(199,81,192) 50%,rgb(65,88,208) 100%);--wp--preset--gradient--pale-ocean: linear-gradient(135deg,rgb(255,245,203) 0%,rgb(182,227,212) 50%,rgb(51,167,181) 100%);--wp--preset--gradient--electric-grass: linear-gradient(135deg,rgb(202,248,128) 0%,rgb(113,206,126) 100%);--wp--preset--gradient--midnight: linear-gradient(135deg,rgb(2,3,129) 0%,rgb(40,116,252) 100%);--wp--preset--font-size--small: 13px;--wp--preset--font-size--medium: 20px;--wp--preset--font-size--large: 36px;--wp--preset--font-size--x-large: 42px;--wp--preset--spacing--20: 0.44rem;--wp--preset--spacing--30: 0.67rem;--wp--preset--spacing--40: 1rem;--wp--preset--spacing--50: 1.5rem;--wp--preset--spacing--60: 2.25rem;--wp--preset--spacing--70: 3.38rem;--wp--preset--spacing--80: 5.06rem;--wp--preset--shadow--natural: 6px 6px 9px rgba(0, 0, 0, 0.2);--wp--preset--shadow--deep: 12px 12px 50px rgba(0, 0, 0, 0.4);--wp--preset--shadow--sharp: 6px 6px 0px rgba(0, 0, 0, 0.2);--wp--preset--shadow--outlined: 6px 6px 0px -3px rgba(255, 255, 255, 1), 6px 6px rgba(0, 0, 0, 1);--wp--preset--shadow--crisp: 6px 6px 0px rgba(0, 0, 0, 1);}:where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}body .is-layout-flex{display: flex;}.is-layout-flex{flex-wrap: wrap;align-items: center;}.is-layout-flex > :is(*, div){margin: 0;}body .is-layout-grid{display: grid;}.is-layout-grid > :is(*, div){margin: 0;}:where(.wp-block-columns.is-layout-flex){gap: 2em;}:where(.wp-block-columns.is-layout-grid){gap: 2em;}:where(.wp-block-post-template.is-layout-flex){gap: 1.25em;}:where(.wp-block-post-template.is-layout-grid){gap: 1.25em;}.has-black-color{color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-color{color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-color{color: var(--wp--preset--color--white) !important;}.has-pale-pink-color{color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-color{color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-color{color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-color{color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-color{color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-color{color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-color{color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-color{color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-color{color: var(--wp--preset--color--vivid-purple) !important;}.has-black-background-color{background-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-background-color{background-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-background-color{background-color: var(--wp--preset--color--white) !important;}.has-pale-pink-background-color{background-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-background-color{background-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-background-color{background-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-background-color{background-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-background-color{background-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-background-color{background-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-background-color{background-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-background-color{background-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-background-color{background-color: var(--wp--preset--color--vivid-purple) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-border-color{border-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-pale-pink-border-color{border-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-border-color{border-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-border-color{border-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-border-color{border-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-border-color{border-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-border-color{border-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-border-color{border-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-border-color{border-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-border-color{border-color: var(--wp--preset--color--vivid-purple) !important;}.has-vivid-cyan-blue-to-vivid-purple-gradient-background{background: var(--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple) !important;}.has-light-green-cyan-to-vivid-green-cyan-gradient-background{background: var(--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan) !important;}.has-luminous-vivid-amber-to-luminous-vivid-orange-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange) !important;}.has-luminous-vivid-orange-to-vivid-red-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-orange-to-vivid-red) !important;}.has-very-light-gray-to-cyan-bluish-gray-gradient-background{background: var(--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray) !important;}.has-cool-to-warm-spectrum-gradient-background{background: var(--wp--preset--gradient--cool-to-warm-spectrum) !important;}.has-blush-light-purple-gradient-background{background: var(--wp--preset--gradient--blush-light-purple) !important;}.has-blush-bordeaux-gradient-background{background: var(--wp--preset--gradient--blush-bordeaux) !important;}.has-luminous-dusk-gradient-background{background: var(--wp--preset--gradient--luminous-dusk) !important;}.has-pale-ocean-gradient-background{background: var(--wp--preset--gradient--pale-ocean) !important;}.has-electric-grass-gradient-background{background: var(--wp--preset--gradient--electric-grass) !important;}.has-midnight-gradient-background{background: var(--wp--preset--gradient--midnight) !important;}.has-small-font-size{font-size: var(--wp--preset--font-size--small) !important;}.has-medium-font-size{font-size: var(--wp--preset--font-size--medium) !important;}.has-large-font-size{font-size: var(--wp--preset--font-size--large) !important;}.has-x-large-font-size{font-size: var(--wp--preset--font-size--x-large) !important;} :where(.wp-block-post-template.is-layout-flex){gap: 1.25em;}:where(.wp-block-post-template.is-layout-grid){gap: 1.25em;} :where(.wp-block-columns.is-layout-flex){gap: 2em;}:where(.wp-block-columns.is-layout-grid){gap: 2em;} :root :where(.wp-block-pullquote){font-size: 1.5em;line-height: 1.6;} </style> <link rel='stylesheet' id='zetaengnblog-style-css' href='https://engineering.zeta.tech/wp-content/themes/zetaengnblog/style.css?ver=1.0.0' media='all' /> <script id="core-js-js-extra"> var ajax_posts = {"ajaxurl":"https:\/\/engineering.zeta.tech\/wp-admin\/admin-ajax.php","noposts":"No older posts found"}; </script> <script src="https://engineering.zeta.tech/wp-content/themes/zetaengnblog/js/core.js?ver=6.6.1" id="core-js-js"></script> <link rel="https://api.w.org/" href="https://engineering.zeta.tech/wp-json/" /><link rel="alternate" title="JSON" type="application/json" href="https://engineering.zeta.tech/wp-json/wp/v2/posts/329" /><link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://engineering.zeta.tech/xmlrpc.php?rsd" /> <link rel="canonical" href="https://engineering.zeta.tech/prestoprestodb-what-it-offers-and-where-and-how-it-can-be-used/" /> <link rel='shortlink' href='https://engineering.zeta.tech/?p=329' /> <link rel="alternate" title="oEmbed (JSON)" type="application/json+oembed" href="https://engineering.zeta.tech/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fengineering.zeta.tech%2Fprestoprestodb-what-it-offers-and-where-and-how-it-can-be-used%2F" /> <link rel="alternate" title="oEmbed (XML)" type="text/xml+oembed" href="https://engineering.zeta.tech/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fengineering.zeta.tech%2Fprestoprestodb-what-it-offers-and-where-and-how-it-can-be-used%2F&format=xml" /> <link rel="pingback" href="https://engineering.zeta.tech/xmlrpc.php"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title> Home page </title> <meta name="description" content="Home page"> <meta name="description" content=""> <link rel="alternate" hreflang="en-US" href="" /> <link rel="canonical" href="" /> <meta name="x-sitemap-settings" content="daily,1"> <meta name="google-site-verification" content="Gyg3Spsr-pKlZLcNRhXHV_2X7aHr72bXxNgj-StYLpo" /> <!-- FACEBOOK OG META TAG --> <script src="https://unpkg.com/aos@next/dist/aos.js"></script> <meta property="og:title" content="Launch Next-Gen Credit Cards With Zeta" /> <meta property="og:description" content="Zeta is the world’s first Omni Stack for credit cards. A single stack for Origination, Processing, FRM, Rewards, Loans, APIs, and Apps" /> <meta property="og:image" content="https://s3.ap-south-1.amazonaws.com/zeta-website-images-prod/images/zeta-opengraph-preview.png" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://www.zeta.tech" /> <meta property="og:site_name" content="www.zeta.tech" /> <base href="/" /> <!-- Google Font --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@200;400;500;600;700&family=Manrope:wght@400;500;600;700&display=swap" rel="stylesheet"> <!-- Google Font End --> </head> <body class=" main-page is-white-mobi-nav"> <!-- Web Banner View --> <section class="z-banner"> <div class="cover"></div> <div class="header-search"> <div class="z-container"> <form role="search" method="get" id="searchform" class="searchform" action="https://engineering.zeta.tech/"> <div> <label class="screen-reader-text" for="s">Search for:</label> <input type="search" id="search-form" placeholder="Search form" value="" name="s" id="s" /> <!-- <input type="submit" id="searchsubmit" value="Search" /> --> </div> </form> </div> </div> <div class="z-container"> <nav> <a href="/" class="logo-top" aria-label="Brand Logo"> <img src="/wp-content/uploads/2022/11/logo-white-xx.png" alt="Brand logo"/> </a> </nav> <h1 class="title"><a href="/" rel="home">Engineering @Zeta</a></h1> </div> </section> <section class="search-bar"> <div class="z-container text-right"> <button class="search-toggle"> <span></span> </button> </div> </section> <!-- / Web Banner View --> <!-- Inner Content View --> <div class="eng-blog-article__wrapper"> <div class="z-container"> <div class="section-inner"> <div id="post-329" class="post-329 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized"> <div class="content"> <div class="post-header"> <a href="https://engineering.zeta.tech/prestoprestodb-what-it-offers-and-where-and-how-it-can-be-used/" rel="bookmark">Presto(PrestoDB)- What it Offers and Where and How it can be used</a> </div> <!-- .post-header --> <div class="featured-media"> <img width="1200" height="613" src="https://engineering.zeta.tech/wp-content/uploads/2023/01/1_4lksLQ-UVCbc5HgvEG6Kvw.jpeg" class="attachment-post-image size-post-image wp-post-image" alt="" decoding="async" fetchpriority="high" srcset="https://engineering.zeta.tech/wp-content/uploads/2023/01/1_4lksLQ-UVCbc5HgvEG6Kvw.jpeg 1200w, https://engineering.zeta.tech/wp-content/uploads/2023/01/1_4lksLQ-UVCbc5HgvEG6Kvw-300x153.jpeg 300w, https://engineering.zeta.tech/wp-content/uploads/2023/01/1_4lksLQ-UVCbc5HgvEG6Kvw-1024x523.jpeg 1024w, https://engineering.zeta.tech/wp-content/uploads/2023/01/1_4lksLQ-UVCbc5HgvEG6Kvw-768x392.jpeg 768w" sizes="(max-width: 1200px) 100vw, 1200px" /> </div><!-- .featured-media --> <div class="post-content"> <figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1400/1*4lksLQ-UVCbc5HgvEG6Kvw.jpeg" alt=""/></figure> <p id="f800"><strong>What is Presto?</strong></p> <p id="39f5">Presto (or PrestoDB) is a distributed, fast, reliable SQL Query Engine that fetches data from heterogeneous data sources querying large sets((TB, PB) of data and processes in memory. It originated in Facebook as a result of Hive taking a long time to execute queries of TB, and PB magnitude. The problem with Hive was that it would store intermediate results on disk which resulted in a significant I/O overhead on disk. In 2015, Netflix showed PrestoDB was 10 times faster than Hive. Presto is written in Java. It resembles a massively parallel processing (MPP) system that facilitates the separation between storage and computing and allows it to scale its computing power horizontally by adding more servers.</p> <p id="3080"><strong>What Presto is Not?</strong></p> <p id="5318">Since Presto understands SQL, it is not a general-purpose relational database. It is not a replacement for MySQL, Oracle, etc., though it provides the features of a standard database. It was not designed to handle OLTP. Its main benefit and value can be seen in Data Warehousing and Analytics where a large volume of data is collected from various sources to produce reports. They fit into the world of OLAP.</p> <p id="e0df"><strong>Presto Architecture</strong></p> <figure class="wp-block-image"><img decoding="async" src="https://miro.medium.com/max/1400/0*x1-t8KAntu7EjEEA" alt=""/></figure> <p id="61e6"><strong>Presto Concepts</strong></p> <p id="1616"><strong>Coordinator</strong>: This is the brain of presto. It receives the query from the client, parses, plans, and manages the worker nodes. It keeps a track of activity on worker nodes and coordinates the execution of the query. It fetches the results from the worker nodes and returns the final result to the client. Additionally, Presto uses a discovery service that is running on the coordinator, where each worker can register and periodically send their heartbeat. This runs on the same HTTP server — including the same port.</p> <p id="583b"><strong>Worker</strong>: Worker nodes are the nodes that execute the tasks and process data. They fetch data from connectors and exchange intermediate data with each other. HTTP is the communication between coordinators and workers, coordinators and clients, and between workers</p> <p id="3d19"><strong>Connector</strong>: Presto uses a connector to connect to various data sources. In the world of databases, this equates to DB drivers. Each connector needs to implement 4 SPI(Service Provider Interface)</p> <ol class="wp-block-list"> <li>Metadata SPI</li> <li>Data Location SPI</li> <li>Data Statistics SPI</li> <li>Data Source SPI</li> </ol> <p id="a9e0"><strong>Catalog</strong>: The catalog contains schemas and references to a data source via a connector.</p> <p id="c735"><strong>Schema</strong>: A schema is a collection of tables. In RDBMS like PostgreSQL and MySQL, this translates to the concept of Schema or a Database.</p> <p id="9cd9"><strong>Table</strong>: Collection of data in terms of rows, columns, and associated data types.</p> <p id="f0d1"><strong>Statement</strong>: Statements are defined in the ANSI SQL standard, consisting of clauses, expressions, and predicates.</p> <p id="a1ec"><strong>Query: </strong>The previous SQL statement is parsed into a query and creates a distributed query plan consisting of a series of interconnected stages that contain all of the below elements.</p> <p id="3e1a"><strong>Stage: </strong>The execution is structured in a hierarchy of stages that resembles a tree. They model the distributed query plan but are not executed by the worker nodes.</p> <p id="8168"><strong>Task:</strong> Each stage consists of a series of tasks that are distributed over the Presto worker nodes. Tasks contain one or more parallel drivers.</p> <p id="ac89"><strong>Split:</strong> Tasks operate on splits, which are sections of a larger data set.</p> <p id="48ba"><strong>Driver:</strong> Drivers work with the data and combine operators to produce output that is aggregated by a task and delivered to another task in another stage. Each driver has one input and one output.</p> <p id="496d"><strong>Operator:</strong> An operator consumes, transforms, and produces data.</p> <p id="9a01"><strong>Exchange:</strong> Exchanges transfer data between Presto nodes for different stages in a query.</p> <p id="23c4"><strong>Presto Connectors</strong></p> <p id="8e7f">Overall there are 30+ known connectors that Presto supports. The following are a few well know connectors that Presto supports.</p> <ol class="wp-block-list"> <li>BigQuery Connector</li> <li>Cassandra Connector</li> <li>Elasticsearch Connector</li> <li>Hive Connector</li> <li>JMX Connector</li> <li>Kafka Connector</li> <li>MongoDB Connector</li> <li>Oracle/MySQL/PostgreSQL Connector</li> <li>Prometheus Connector</li> <li>Redis Connector</li> <li>Redshift Connector</li> <li>Delta Lake Connector</li> </ol> <p id="3bad"><strong>Event Listener</strong></p> <p id="54e7">One of the nice things about Presto is clean abstractions, one such clean abstraction is Event Listeners. Event Listener allows you to write custom functions that listen to events happening inside the engine. Event listeners are invoked for the following events:</p> <ol class="wp-block-list"> <li>Query creation</li> <li>Query completion</li> <li>Split completion</li> </ol> <p id="768e">To Create Custom Listeners we would need to do the following:</p> <ol class="wp-block-list"> <li>Implement EventListener and EventListenerFactory interfaces.</li> <li>Register the plugins and deploy the plugin to Presto.</li> </ol> <p id="ce8c">Query Optimization</p> <p id="259c">PrestoDB uses two optimizers. The Rule-Based Optimizer (RBO) applies filters to remove irrelevant data and uses hash joins to avoid full cartesian joins. This includes strategies such as predicate pushdown, limit pushdown, column pruning, and decorrelation. It also uses a Cost-Based Optimizer (CBO). Here it uses statistics of the table (e.g., number of distinct values, number of null values, distributions of column data) to optimize queries and reduce I/O and network overhead. The following are ways to see available statistics and see cost-based analysis of a query</p> <p id="fee1">SHOW STATS FOR table_name — Approximated statistics for the named table</p> <p id="798e">SHOW STATS FOR ( SELECT query ) — Approximated statistics for the query result</p> <p id="166e">EXPLAIN SELECT query — Execute statement and show the distributed execution plan with the cost of each operation.</p> <p id="6dbb">EXPLAIN ANALYZE SELECT — Execute statement and show the distributed execution plan with the cost and duration of each operation.</p> <p id="05ba"><strong>SQL Language and SQL Statement Syntax</strong></p> <p id="e9c0">We can use DDL, DML, DQL, DCL, TCL which modern databases support. The following are supported in PrestoDB</p> <ol class="wp-block-list"> <li>DDL — Create, Alter, Drop, Truncate</li> <li>DML — Insert, Delete, Call</li> <li>TCL — Commit, Rollback, Start Transaction</li> <li>DQL — Select</li> <li>DCL — Grant, Revoke</li> </ol> <p id="b69f">It also supports the following data types</p> <p id="6a29">Boolean, TINYINT, SMALLINT, INTEGER, BIGINT, DOUBLE, DECIMAL, VARCHAR, CHAR, JSON, DATE, TIME, TIMESTAMP, ARRAY, MAP, IPADDRESS</p> <p id="0693">An Example with JMX Connector</p> <p id="a7dd">Java Management Extensions (JMX) gives information about the Java Virtual Machine and software running inside JVM. With the JMX connector, we can query JMX information from all nodes in a Presto cluster. JMX is actually a connector that is figured so that chosen JMX information will be periodically dumped and stored in tables (in the “jmx” catalog) which can be queried. JMX is useful for debugging and monitoring Presto metrics.</p> <p id="2583">To configure the JMX connector, create catalog properties file <em>etc/catalog/jmx.properties</em> with the following</p> <p id="46f4">connector.name=jmx</p> <p id="6242">JMX connector supports 2 schemas — current and history</p> <p id="3737">To enable periodical dumps, define the following properties:</p> <p id="b076">connector.name=jmx</p> <p id="4de9">jmx.dump-tables=java.lang:type=Runtime,com.facebook.presto.execution.scheduler:name=NodeScheduler</p> <p id="2232">jmx.dump-period=10s</p> <p id="fe53">jmx.max-entries=86400</p> <p id="8dc2">We will use jdbc driver to connect to presto — com.facebook.presto.jdbc.PrestoDriver</p> <p id="d928">the following is used to extract the JVM version of every node.<code><em><span class="has-inline-color has-accent-color">String dbUrl= “jdbc:presto://localhost:9000/catalogName/schemaName”;</span></em></code></p> <blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"> <p><code><em><span class="has-inline-color has-accent-color">Connection conn = null;</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">Statement stmt = null;</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">try {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">Class.forName(“com.facebook.presto.jdbc.PrestoDriver”);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">conn = DriverManager.getConnection(dbUrl, “username”, “password”);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">stmt = conn.createStatement();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">String sql = “SELECT node, vmname, vmversion from jmx.current.java.lang:type=runtime”;</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">ResultSet res = stmt.executeQuery(sql);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">while (res.next()) {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">String node= res.getString(“node”);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">String vmname= res.getString(“vmname”);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">String vmversion= res.getString(“vmversion”);</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">}</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">res.close();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">stmt.close();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">conn.close();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">} catch (SQLException se) {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">se.printStackTrace();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">} catch (Exception e) {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">e.printStackTrace();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">} finally {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">try {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">if (stmt != null) stmt.close();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">} catch (SQLException sqlException) {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">sqlException.printStackTrace();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">}</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">try {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">if (conn != null) conn.close();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">} catch (Exception e) {</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">e.printStackTrace();</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">}</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">}</span></em></code></p> <p><code><em><span class="has-inline-color has-accent-color">}</span></em></code></p> <p><code><em>}</em></code></p> </blockquote> <p id="ca3e">If we want to see all of the available MBeans by running SHOW TABLES, we can use SHOW TABLES FROM jmx.current</p> <p id="f181">If we want to see the open and maximum file descriptor counts for each node then the following is the query — SELECT openfiledescriptorcount, maxfiledescriptorcount</p> <p id="8c16">FROM jmx.current.java.lang:type=operatingsystem`</p> <p id="24d8"><strong>Where can Presto be used?</strong></p> <ol class="wp-block-list"> <li>It can be used in Data Warehouse where data is fetched from multiple sources in TB and PB to query and process large datasets</li> <li>It can be used to run ad hoc queries from various sources through multiple connectors anytime we want and wherever the data resides</li> <li>It can be used for generating reports and dashboards as data is collected from various sources that are in multiple formats for analytics and business intelligence</li> <li>We can aggregate TBs of data from multiple data sources and run ETL queries against that data instead of using legacy batch processing systems, we can use presto to run efficient and high throughput queries</li> <li>We can query data on a data lake without the need for transformation. we can query any type of data in a data lake, including both structured and unstructured data as there are various connectors to pull from structured and unstructured sources</li> </ol> <p id="ac77">Author: <a rel="noreferrer noopener" href="https://medium.com/u/ff0a3ad2cb29?source=post_page-----6adfe10465e6--------------------------------" target="_blank">Bhargav Maddikera</a> </p> </div> <div class="post-meta-container"> <div class="post-author"> <div class="post-author-content"> <h4>Phani</h4> <div class="author-links"> <a class="author-link-posts" href="https://engineering.zeta.tech/author/phani_marpaka/">Author archive</a> </div><!-- .author-links --> </div><!-- .post-author-content --> </div><!-- .post-author --> <div class="post-meta"> <p class="post-date">January 24, 2023</p> <p class="post-categories"><a href="https://engineering.zeta.tech/category/uncategorized/" rel="category tag">Uncategorized</a></p> <div class="clear"></div> <!-- post-nav --> <div class="post-nav"> <a class="post-nav-prev" href="https://engineering.zeta.tech/effective-troubleshooting/">Previous post</a> <div class="clear"></div> </div><!-- .post-nav --> </div> <!-- post-meta --> <div class="clear"></div> </div> <div id="comments" class="comments-area"> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/prestoprestodb-what-it-offers-and-where-and-how-it-can-be-used/#respond" style="display:none;">Cancel reply</a></small></h3><form action="https://engineering.zeta.tech/wp-comments-post.php?wpe-comment-post=engnblog" method="post" id="commentform" class="comment-form" novalidate><p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p><p class="comment-form-comment"><label for="comment">Comment <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required></textarea></p><p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" autocomplete="name" required /></p> <p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="email" value="" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email" required /></p> <p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="url" value="" size="30" maxlength="200" autocomplete="url" /></p> <p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" /> <label for="wp-comment-cookies-consent">Save my name, email, and website in this browser for the next time I comment.</label></p> <p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Post Comment" /> <input type='hidden' name='comment_post_ID' value='329' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </p></form> </div><!-- #respond --> </div><!-- #comments --> </div> <div class="sidebar"> <div class="widget"> <input type="search" class="search-field" placeholder="Search form" value=""> </div> <div class="widget entries"> <div class="widget-content"> <h3 class="widget-title">Recent Posts</h3> <ul> <li> <a href="#" aria-current="page">Effective Troubleshooting</a> </li> <li> <a href="#">Zeta Tech Stack</a> </li> <li> <a href="#">Buy Now Pay Later: How Does it Work?</a> </li> <li> <a href="#">Buy Now Pay Later: The Real Deal or Just Hype</a> </li> <li> <a href="$">Buy Now Pay Later: The Modern Day Credit Card</a> </li> </ul> </div> </div> </div> <div class="clear"></div> </div> </div> </div> </div> <!-- / Inner Content View --> <!-- Footer --> <footer class="footer-section custom-footer"> <div class="z-container"> <div class="footer-table"> <div class="footer-table__row"> <div id="footer-sidebar1" class="footer-table__cell1 width__40"> <aside> <h3 class="widget-title">RECENT POSTS</h3> <ul> <li><a href="https://engineering.zeta.tech/prestoprestodb-what-it-offers-and-where-and-how-it-can-be-used/">Presto(PrestoDB)- What it Offers and Where and How it can be used</a> <span class="post-date">January 24, 2023</span></li> <li><a href="https://engineering.zeta.tech/effective-troubleshooting/">Effective Troubleshooting</a> <span class="post-date">September 2, 2022</span></li> <li><a href="https://engineering.zeta.tech/zeta-tech-stack/">Zeta Tech Stack</a> <span class="post-date">September 15, 2021</span></li> <li><a href="https://engineering.zeta.tech/buy-now-pay-later-how-does-it-work/">Buy Now Pay Later: How Does it Work?</a> <span class="post-date">July 26, 2021</span></li> <li><a href="https://engineering.zeta.tech/buy-now-pay-later-the-real-deal-or-just-hype/">Buy Now Pay Later: The Real Deal or Just Hype</a> <span class="post-date">July 26, 2021</span></li> </ul> </aside> </div> <div id="footer-sidebar2" class="footer-table__cell2"> <aside id="nav_menu-4" class="widget widget_nav_menu"><h3 class="widget-title">INTERESTING READS</h3><div class="menu-dummy-container"><ul id="menu-dummy" class="menu"><li id="menu-item-318" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-318"><a href="https://engineering.zeta.tech/bengaluru/">Bengaluru</a></li> <li id="menu-item-319" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-319"><a href="https://engineering.zeta.tech/hot-desking/">Hot Desking</a></li> <li id="menu-item-320" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-320"><a href="https://engineering.zeta.tech/groups/">Groups</a></li> </ul></div></aside></div> <div id="footer-sidebar3" class="footer-table__cell3"> <aside id="nav_menu-3" class="widget widget_nav_menu"><h3 class="widget-title">FOR ZETA EMPLOYEES</h3><div class="menu-general-container"><ul id="menu-general" class="menu"><li id="menu-item-313" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-313"><a href="#">Hotdesk</a> <ul class="sub-menu"> <li id="menu-item-314" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-314"><a href="https://engineering.zeta.tech/bengaluru/">Bengaluru</a></li> <li id="menu-item-315" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-315"><a href="https://engineering.zeta.tech/mumbai/">Mumbai</a></li> </ul> </li> </ul></div></aside></div> </div> </div> </div> </footer> <section class="footer-bar"> <div class="z-container flex"> <p class="footer-bar__left"> © 2022 <a href="#">Engineering @Zeta</a> <span> — © 2021 Better World Technology Pvt. Ltd.</span> </p> <p class="footer-bar__right"> <a class="goto-top" href="javascript:void(0)">Go Up ↑</a> </p> </div> </section> <!-- Footer End --> <script src="https://engineering.zeta.tech/wp-content/themes/zetaengnblog/js/navigation.js?ver=1.0.0" id="zetaengnblog-navigation-js"></script> <script src="https://engineering.zeta.tech/wp-includes/js/comment-reply.min.js?ver=6.6.1" id="comment-reply-js" async data-wp-strategy="async"></script> <script src="https://engineering.zeta.tech/wp-content/themes/zetaengnblog/js/main.9247e6bf2f7c0404c8a7.js?ver=1.0.0" id="zetaengnblog-blog-js"></script> <script src="https://engineering.zeta.tech/wp-content/themes/zetaengnblog/js/styles.e772312fa7689f75b2c1.js?ver=1.0.0" id="zetaengnblog-blog1-js"></script> </body> </html>