Infrastructure at your Service

All Posts By

Daniel Westermann

Daniel Westermann

Telling the PostgreSQL optimizer more about your functions

By | Database Administration & Monitoring | No Comments

When you reference/call functions in PostgreSQL the optimizer does not really know much about the cost nor the amount of rows that a function returns. This is not really surprising as it is hard to predict what the functions is doing and how many rows will be returned for a given set of input parameters. What you might not know is, that indeed you can tell the optimizer a bit more about your functions.

Read More
Daniel Westermann

PostgreSQL on the beach, PGIBZ, recap

By | Database Administration & Monitoring | No Comments

So, finally, PostgreSQL on the beach is over. During discussions it was mentioned that some companies had issues to justify sending people to a conference to Ibiza. It was not really clear if they wanted to avoid the impression of making holidays while going to a conference or if it was just about the location. I am not judging this at all but what I can tell: It was a great, very relaxed and very…

Read More
Daniel Westermann

PostgreSQL partitioning (8): Sub-partitioning

By | Database Administration & Monitoring | No Comments

We are slowly coming to the end of this little series about partitioning in PostgreSQL. In the last post we had a look at indexing and constraints and today we will have a look at sub partitioning. Sub partitioning means you go one step further and partition the partitions as well. Although it is not required to read all the posts of this series to follow this one: If you want, here they are: PostgreSQL…

Read More
Daniel Westermann

PostgreSQL partitioning (7): Indexing and constraints

By | Database Administration & Monitoring | No Comments

Yesterday we talked about attaching and detaching of partitions. Today we will look at indexing and constraints when it comes to partitioned tables. If you missed the last posts, again, here they are: PostgreSQL partitioning (1): Preparing the data set PostgreSQL partitioning (2): Range partitioning PostgreSQL partitioning (3): List partitioning PostgreSQL partitioning (4) : Hash partitioning PostgreSQL partitioning (5): Partition pruning PostgreSQL partitioning (6): Attaching and detaching partitions

Read More
Daniel Westermann

PostgreSQL partitioning (6): Attaching and detaching partitions

By | Database Administration & Monitoring | No Comments

Having talked about partitioning strategies and partition pruning this time we will have a look on how you can attach and detach partitions to and from an existing partitioned table. If you missed the last posts about partitioning in PostgreSQL here they are: PostgreSQL partitioning (1): Preparing the data set PostgreSQL partitioning (2): Range partitioning PostgreSQL partitioning (3): List partitioning PostgreSQL partitioning (4) : Hash partitioning PostgreSQL partitioning (5): Partition pruning

Read More
Daniel Westermann

PostgreSQL partitioning (5): Partition pruning

By | Database Administration & Monitoring | No Comments

This is the next post in the PostgreSQL partitioning series. If you missed the previous ones here they are: PostgreSQL partitioning (1): Preparing the data set PostgreSQL partitioning (2): Range partitioning PostgreSQL partitioning (3): List partitioning PostgreSQL partitioning (4): Hash partitioning This time we will have a look at partition pruning. Never heard of that? Don’t worry, hopefully it will be clear at the end of this blog post.

Read More
Daniel Westermann

PostgreSQL partitioning (4): Hash partitioning

By | Database Administration & Monitoring | No Comments

The last partitioning strategy we will look at is: hash partitioning. If you missed the first posts in this series here they are: PostgreSQL partitioning (1): Preparing the data set PostgreSQL partitioning (2): Range partitioning PostgreSQL partitioning (3): List partitioning Usually hash partitioning is used when you do not have a natural way of partitioning your data or you want to evenly distribute the data based on hash.

Read More
Daniel Westermann

PostgreSQL partitioning (2): Range partitioning

By | Database Administration & Monitoring | No Comments

Now that the data set is ready we will look at the first partitioning strategy: Range partitioning. Usually range partitioning is used to partition a table by days, months or years although you can partition by other data types as well. Time/date based range partitioning is probably the most common use case so we will partition our traffic violation data by year and later on sub partition that month.

Read More