<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Performance on BonesMoses.org</title>
    <link>https://bonesmoses.org/tags/performance/</link>
    <description>Recent content in Performance on BonesMoses.org</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 09 Dec 2016 12:07:14 +0000</lastBuildDate><atom:link href="https://bonesmoses.org/tags/performance/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>PG Phriday: Planner Pitfalls</title>
      <link>https://bonesmoses.org/2016/pg-phriday-planner-pitfalls/</link>
      <pubDate>Fri, 09 Dec 2016 12:07:14 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2016/pg-phriday-planner-pitfalls/</guid>
      <description>Recently a coworker asked me this question:
Should I expect variance between minutes and hours for the same query?
And I was forced to give him this answer:
Potentially, but not commonly. Query planning is an inexact science, and regardless of the query being the &amp;ldquo;same query,&amp;rdquo; the data is not the &amp;ldquo;same data.&amp;rdquo; This isn&amp;rsquo;t generally the case, but on occasion, changes in data can affect the query execution path.</description>
    </item>
    
    <item>
      <title>PG Phriday: Primal Planner Prep</title>
      <link>https://bonesmoses.org/2016/pg-phriday-primal-planner-prep/</link>
      <pubDate>Fri, 18 Nov 2016 14:22:16 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2016/pg-phriday-primal-planner-prep/</guid>
      <description>The Postgres query planner is house of cards built upon the ever-shifting sand of our data. It has the utterly impossible mission of converting our ridiculous and inane requests into a logical series of fetch, filter, sort, join, and other instructions. Then the resulting steps must be ruthlessly efficient or the execution phase could very well saturate every hardware resource available; Set Theory isn&amp;rsquo;t very forgiving.
Forewarned is forearmed is very apt when applied to database query planners.</description>
    </item>
    
    <item>
      <title>PG Phriday: Broken Parts</title>
      <link>https://bonesmoses.org/2016/pg-phriday-broken-parts/</link>
      <pubDate>Fri, 21 Oct 2016 11:48:49 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2016/pg-phriday-broken-parts/</guid>
      <description>Partitioning tables in Postgres can be an extremely risky endeavor. Unfortunately on many larger systems, it&amp;rsquo;s also essentially a requirement; the maximum size of a Postgres table is 32TB. This isn&amp;rsquo;t just because converting an existing table to a series of partitions is expensive or time consuming. We must consider how the query planner will react to the partitioned version of a table. There&amp;rsquo;s also the very real risk we will (or already have) implement flaws in the trigger or constraint logic.</description>
    </item>
    
    <item>
      <title>PG Phriday: Pesky Partition Plans</title>
      <link>https://bonesmoses.org/2016/pg-phriday-pesky-partition-plans/</link>
      <pubDate>Fri, 07 Oct 2016 14:05:51 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2016/pg-phriday-pesky-partition-plans/</guid>
      <description>For all of those warehouse queries that never seem to complete before the heat death of the universe, there&amp;rsquo;s often a faster version. Sometimes this is due to a fundamental misunderstanding of how queries work, or how Postgres specifically functions. The trick is knowing when to back away slowly from an ugly but efficient query, and when to inject a flurry of predicates to fully illustrate the original intent of the query so the planner makes better decisions.</description>
    </item>
    
    <item>
      <title>PG Phriday: EXCEPTIONal Performance</title>
      <link>https://bonesmoses.org/2016/pg-phriday-exceptional-performance/</link>
      <pubDate>Fri, 01 Jul 2016 11:41:45 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2016/pg-phriday-exceptional-performance/</guid>
      <description>Like any programming language, the PL/pgSQL Postgres procedural language has plenty of handy control structures. Among those thankfully modern accoutrements is the humble EXCEPTION block. While not the more prevalent try/catch methodology, we can use BEGIN anywhere to start an embedded section for the same effect.
Knowing this is the case, what are the costs of actually using them? Postgres is fairly streamlined, and as such, can take several shortcuts when there are no exception blocks within a chunk of PL/pgSQL.</description>
    </item>
    
    <item>
      <title>PG Phriday: Parallel Sequence Scans</title>
      <link>https://bonesmoses.org/2015/pg-phriday-parallel-sequence-scans/</link>
      <pubDate>Fri, 13 Nov 2015 11:49:43 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-parallel-sequence-scans/</guid>
      <description>A couple days ago, Robert Haas announced that he checked in the first iteration of parallel sequence scans in the Postgres 9.6 branch. And no, that&amp;rsquo;s not a typo. One of the great things about the Postgres devs is that they have a very regimented system of feature freezes to help ensure timely releases. Thus even though 9.5 just released its second beta, they&amp;rsquo;re already working on 9.6.
So what is a sequence scan, and why does this matter?</description>
    </item>
    
    <item>
      <title>PG Phriday: Massively Distributed Operation</title>
      <link>https://bonesmoses.org/2015/pg-phriday-massively-distributed-operation/</link>
      <pubDate>Fri, 30 Oct 2015 12:12:46 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-massively-distributed-operation/</guid>
      <description>Postgres has been lacking something for quite a while, and more than a few people have attempted to alleviate the missing functionality multiple times. I&amp;rsquo;m speaking of course, about parallel queries. There are several reasons for this, and among them include various distribution and sharding needs for large data sets. When tables start to reach hundreds of millions, or even billions of rows, even high cardinality indexes produce results very slowly.</description>
    </item>
    
    <item>
      <title>PG Phriday: Parallel-O-Postgres</title>
      <link>https://bonesmoses.org/2015/pg-phriday-parallel-o-postgres/</link>
      <pubDate>Fri, 16 Oct 2015 11:58:11 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-parallel-o-postgres/</guid>
      <description>I wasn&amp;rsquo;t able to write an article last week due to an unexpected complication regarding tests I was running to verify its contents. So this week, it&amp;rsquo;s going to be extra special! Also long.
What&amp;rsquo;s the fastest way to load a Postgres table? If you believe the documentation, the COPY command is the best way to unceremoniously heave data into a table. Fortunately after all of our talk about partitions, our minds are primed and ready to think in chunks.</description>
    </item>
    
    <item>
      <title>PG Phriday: When Partitioning Goes Wrong</title>
      <link>https://bonesmoses.org/2015/pg-phriday-when-partitioning-goes-wrong/</link>
      <pubDate>Fri, 02 Oct 2015 16:33:10 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-when-partitioning-goes-wrong/</guid>
      <description>I&amp;rsquo;ve been talking about partitions a lot recently, and I&amp;rsquo;ve painted them in a very positive light. Postgres partitions are a great way to distribute data along a logical grouping and work best when data is addressed in a fairly isloated manner. But what happens if we direct a basic query at a partitioned table in such a way that we ignore the allocation scheme? Well, what happens isn&amp;rsquo;t pretty. Let&amp;rsquo;s explore in more detail.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Sex Offenders</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-sex-offenders/</link>
      <pubDate>Fri, 24 Jul 2015 12:20:16 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-sex-offenders/</guid>
      <description>We&amp;rsquo;re finally at the end of the 10-part Postgres (PostgreSQL) performance series I use to initiate new developers into the database world. To that end, we&amp;rsquo;re going to discuss something that affects everyone at one point or another: index criteria. Or to put it another way:
Why isn&amp;rsquo;t the database using an index?
It&amp;rsquo;s a fairly innocuous question, but one that may have a surprising answer: the index was created using erroneous assumptions.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Indexing the World</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-indexing-the-world/</link>
      <pubDate>Fri, 17 Jul 2015 11:42:28 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-indexing-the-world/</guid>
      <description>An easy way to give Postgres (PostgreSQL) a performance boost is to judiciously use indexes based on queries observed in the system. For most situations, this is as simple as indexing columns that are referenced frequently in WHERE clauses. Postgres is one of the few database engines that takes this idea even further with partial indexes. Unfortunately as a consequence of insufficient exposure, most DBAs and users are unfamiliar with this extremely powerful functionality.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: MAXimized Value</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-maximized-value/</link>
      <pubDate>Fri, 10 Jul 2015 12:46:10 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-maximized-value/</guid>
      <description>I apologize for putting this series on a short hiatus last week for the 4th of July. But worry not, for this week is something special for all the developers out there! I&amp;rsquo;m going to try to make your life easier for a change. Screw the database!
As a Postgres (PostgreSQL) DBA, it&amp;rsquo;s easy to get tied up in performance hints, obscure syntax, and mangled queries, but it&amp;rsquo;s really all about the people.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: In The Loop</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-in-the-loop/</link>
      <pubDate>Fri, 26 Jun 2015 11:18:29 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-in-the-loop/</guid>
      <description>As a database, Postgres (PostgreSQL) is fairly standard in its use of SQL. Developers of all colors however, might have trouble switching gears and thinking in set operations, since so many language constructs focus on conditionals and looping. Last week in the performance pitfalls series, we discussed a bit of Set Theory, and how ignorance of its implications can be disastrous. But what about the more mundane?
What happens, for instance, when we treat a database like a programming language?</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Functionally Bankrupt</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-functionally-bankrupt/</link>
      <pubDate>Fri, 19 Jun 2015 12:01:23 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-functionally-bankrupt/</guid>
      <description>Functions are great. Having cut my teeth on a database that didn&amp;rsquo;t even provide the ability to define functions, I&amp;rsquo;ve come to almost take them for granted in Postgres (PostgreSQL). However, with this kind of ubiquity, sometimes they can be overused in ways that don&amp;rsquo;t seem to be part of the common programmer lexicon. In this week&amp;rsquo;s PG Phriday series on performance-killing missteps, I&amp;rsquo;m going to talk a bit about set theory, and how a certain amount of familiarity is necessary to properly interact with a database.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Out Of Order</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-out-of-order/</link>
      <pubDate>Fri, 12 Jun 2015 12:14:34 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-out-of-order/</guid>
      <description>There are a lot of database engines out there. As such, a developer or DBA will naturally have varying levels of experience with each, and some of this might conflict with how Postgres (PostgreSQL) operates. These kinds of embedded misunderstandings can cause potential issues by themselves, but in this particular case, corrective action is fairly simple.
So this week, I&amp;rsquo;d like to talk about indexes. Many people treat them as a &amp;ldquo;make query faster&amp;rdquo; button, and this often results in egregious misuse.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Cast Away</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-cast-away/</link>
      <pubDate>Fri, 05 Jun 2015 12:31:32 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-cast-away/</guid>
      <description>Unlike a lot of programming languages that have loose typing, databases are extremely serious about data types. So serious in fact, many patently refuse to perform automatic type conversions in case the data being compared is not exactly equivalent afterwards. This is the case with Postgres (PostgreSQL) and surprisingly often, queries will suffer as a result. Fortunately this is something we can address!
There are easier ways to demonstrate this, but in the interests of making this more of an adventure, let&amp;rsquo;s use a join between two tables:</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: IN-Sanity</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-in-sanity/</link>
      <pubDate>Fri, 29 May 2015 12:17:32 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-in-sanity/</guid>
      <description>When working with a database, sometimes performance problems are both far more subtle, and much worse than a query itself might suggest. The topic of this week&amp;rsquo;s Postgres (PostgreSQL) performance killers article concerns the use of the IN clause, and how misusing it can catastrophically obliterate the database in mysterious ways.
To that end, we&amp;rsquo;ll use a slightly revised single-table test case since it&amp;rsquo;s served us pretty well so far:</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Forgetting it EXISTS</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-forgetting-it-exists/</link>
      <pubDate>Fri, 22 May 2015 18:41:33 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-forgetting-it-exists/</guid>
      <description>For the second of my ten part series on hidden Postgres (PostgreSQL) performance killers, I&amp;rsquo;m going to talk about something called an anti-join. It&amp;rsquo;s not a well-known approach outside of the database world, but due to how it works, it can impart almost magical plan revisions that drastically improve query performance in the right scenario. Developers can add it to a growing bag of tricks when working on database-driven content, since it comes in handy more often than you might expect.</description>
    </item>
    
    <item>
      <title>PG Phriday: 10 Ways to Ruin Performance: Forgetting to EXPLAIN</title>
      <link>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-forgetting-to-explain/</link>
      <pubDate>Fri, 15 May 2015 14:47:12 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-10-ways-to-ruin-performance-forgetting-to-explain/</guid>
      <description>Yesterday I gave the developers at my company what I call a DBA Chat. It&amp;rsquo;s something I try to do every month to keep them apprised on various features, caveats, performance considerations, and so on. I find that educating the folks who regularly work with the database does wonders for application performance and my sanity. The benefit of this long format is that I can go over more information than a time constrained set of slides.</description>
    </item>
    
    <item>
      <title>PG Phriday: Functions and Performance Attributes</title>
      <link>https://bonesmoses.org/2015/pg-phriday-functions-and-performance-attributes/</link>
      <pubDate>Fri, 08 May 2015 15:56:42 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-functions-and-performance-attributes/</guid>
      <description>Users both old and new are likely aware that Postgres has functions. Some lucky readers may have even written one or two. For those without much experience in this area, or are thinking about contributing a few functions to your database for the first time, there are a couple things you should know. This week, I want to cover a few of the function declaration decorators. If you have no idea what I&amp;rsquo;m talking about, then this is probably something you&amp;rsquo;ll want to read regardless of your experience level.</description>
    </item>
    
    <item>
      <title>PG Phriday: Let&#39;s Talk About Data Storage</title>
      <link>https://bonesmoses.org/2015/pg-phriday-lets-talk-about-data-storage/</link>
      <pubDate>Fri, 24 Apr 2015 11:48:06 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-lets-talk-about-data-storage/</guid>
      <description>As a DBA, I strive not to live in an isolated ivory tower, away from the developers that are destined to fill our databases with volumes of data from a myriad of applications. It&amp;rsquo;s important, I think, to occasionally come back to the basics. So I&amp;rsquo;d like to discuss one of the core elements that Postgres DBAs might be intimately familiar with, but comes up often enough that some clarification is warranted.</description>
    </item>
    
    <item>
      <title>A Short Examination of pg_shard</title>
      <link>https://bonesmoses.org/2015/a-short-examination-of-pg_shard/</link>
      <pubDate>Thu, 12 Mar 2015 16:28:01 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/a-short-examination-of-pg_shard/</guid>
      <description>For part of today, I&amp;rsquo;ve been experimenting with the new-ish pg_shard extension contributed by CitusData. I had pretty high hopes for this module and was extremely excited to try it out. After screwing around with it for a while, I can say it has a lot of potential. Yet I can&amp;rsquo;t reasonably recommend it in its current form. The README file suggests quite a few understandable caveats, but it&amp;rsquo;s the ones they don&amp;rsquo;t mention that hurt a lot more.</description>
    </item>
    
    <item>
      <title>PG Phriday: Materialized Views, Revisited</title>
      <link>https://bonesmoses.org/2015/pg-phriday-materialized-views-revisited/</link>
      <pubDate>Fri, 06 Mar 2015 11:32:08 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-materialized-views-revisited/</guid>
      <description>Materialized views are a great improvement to performance in many cases. Introduced in PostgreSQL 9.3, they finally added an easy method for turning a view into a transient table that could be indexed, mined for statistics for better planner performance, and easily rebuilt. Unfortunately, refreshing a materialized view in PostgreSQL 9.3 caused a full exclusive lock, blocking any use until the process was complete. In 9.4, this can finally be done concurrently, though there are still a couple caveats.</description>
    </item>
    
    <item>
      <title>PG Phriday: PostgreSQL Select Filters</title>
      <link>https://bonesmoses.org/2015/pg-phriday-postgresql-select-filters/</link>
      <pubDate>Fri, 27 Feb 2015 11:54:29 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2015/pg-phriday-postgresql-select-filters/</guid>
      <description>Long have CASE statements been a double-edged sword in the database world. They&amp;rsquo;re functional, diverse, adaptive, and simple. Unfortunately they&amp;rsquo;re also somewhat bulky, and when it comes to using them to categorize aggregates, something of a hack. This is why I wanted to cry with joy when I found out that PostgreSQL 9.4 introduced a feature I&amp;rsquo;ve always wanted, but found difficult to express as a need. I mean, CASE statements are fine, right?</description>
    </item>
    
    <item>
      <title>Friends Don&#39;t Let Friends Use Loops</title>
      <link>https://bonesmoses.org/2014/friends-dont-let-friends-use-loops/</link>
      <pubDate>Fri, 25 Jul 2014 12:12:06 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2014/friends-dont-let-friends-use-loops/</guid>
      <description>Programming is fun. I love programming! Ever since I changed my career from programming to database work, I&amp;rsquo;ve still occasionally dabbled in my former craft. As such, I believe I can say this with a fair amount of accuracy: programmers don&amp;rsquo;t understand databases. This isn&amp;rsquo;t something small, either; there&amp;rsquo;s a fundamental misunderstanding at play. Unless the coder happens to work primarily with graphics, bulk set-based transformations are not something they&amp;rsquo;ll generally work with.</description>
    </item>
    
    <item>
      <title>Foreign Keys are Not Free</title>
      <link>https://bonesmoses.org/2014/foreign-keys-are-not-free/</link>
      <pubDate>Wed, 14 May 2014 16:40:23 +0000</pubDate>
      
      <guid>https://bonesmoses.org/2014/foreign-keys-are-not-free/</guid>
      <description>PostgreSQL is a pretty good database, and I enjoy working with it. However, there is an implementation detail that not everyone knows about, which can drastically affect table performance. What is this mysterious feature? I am, of course, referring to foreign keys.
Foreign keys are normally a part of good database design, and for good reason. They inform about entity relationships, and they verify, enforce, and maintain those relationships. Yet all of this comes at a cost that might surprise you.</description>
    </item>
    
  </channel>
</rss>
