Press "Enter" to skip to content

Curated SQL Posts

Hierarchy Management in PostgreSQL

Boris Novikov builds a list:

The Postgres database management system was originally designed as object-relational. We remind why PostgreSQL is an object-relational rather than just relational database management system, and briefly discuss what kind of object-oriented features it offers. We demonstrate how these features can be used to manage hierarchies, and how applications can benefit using them.

Click through for a technique native to PostgreSQL.

Comments closed

A Primer on Wait Stats in SQL Server

Kevin Hill wants to know where your server hurts:

Everything in SQL Server is waiting for something…this is by design. And most people never think about it…

Until your application is waiting to complete its request, sell the product or provide “the report” to the CEO!

Most SQL Server performance issues come down to one thing: waiting. Every time a query slows down, SQL Server records what it was waiting on. These wait stats are one of the best diagnostic tools for DBAs, sysadmins, and developers – but only if you know how to use them.

Click through for the explanation. Kevin does a great job of proving the 100-level explanation of wait stats to new DBAs, giving them an understanding of what wait stats are, why they are important, and how we can use them to troubleshoot a performance issue. After really locking in the 100-level explanation, it’s a good idea to come back later and understand the difference between signal and non-signal waits (and when that’s relevant), how to track wait stats as part of a query execution plan, and how to correlate wait stats with other measures to find the root cause sooner.

Comments closed

A Dive into Oracle Memory

Kellyn Gorman remembers:

When describing Oracle features to folks that are new to the platform or coming from other database platforms, I found it’s best to keep it simple, but take on the important aspects of the technology.  I’m going to take on a few more posts on Oracle internals from the perspective of the individual new to Oracle.

To start, I’ve been having some long discussions, as well as documenting how Oracle memory works and how we monitor it when you don’t have the diagnostic and tuning pack at your disposal.  With the exclusion of these management packs, you have to be intentional in your queries to provide the data, without violating the licensing by using the %_HIST_% views.

Click through for an overview of how Oracle makes use of memory and how you can monitor this usage.

Comments closed

Using the Microsoft Fabric SKU Estimator

Andreas Bergstedt shows off a new tool:

In today’s ever-changing analytics landscape it can be difficult to plan out your next project or your enterprise analytics roadmap.

Designed to optimize data infrastructure planning, the Microsoft Fabric SKU Estimator helps customers and partners to accurately estimate capacity requirements and select the most suitable SKU for their workloads, protecting users from under-provisioning and overcommitment.

Click through for a few scenarios of translating your existing warehousing and analytical systems into expected Microsoft Fabric needs.

Comments closed

Behind the Scenes in Developing a Cassandra Password Validator

Stefan Miklosovic walks us through a new feature in Apache Cassandra:

Here’s the problem: while users have always had the ability to create whatever password they wanted in Cassandra–from straightforward to incredibly complex and everything in between–this ultimately created a noticeable security vulnerability.

While organizations might have internal processes for generating secure passwords that adhere to their own security policies, Cassandra itself did not have the means to enforce these standards. To make the security vulnerability worse, if a password initially met internal security guidelines, users could later downgrade their password to a less secure option simply by using “ALTER ROLE” statements.

Read on to see how CEP-24 helps with this. It looks like CEP-24 will be released in Apache Cassandra 5.1.

Comments closed

Securing Parquet Files

Vamshidhar Morusu writes on vulnerabilities:

Although open-source Java libraries are essential for contemporary software development, they frequently introduce serious security flaws that put systems at risk. The risks are highlighted by recent examples:

  • Deep Java Library (CVE-2025-0851): Attackers can write files outside of designated directories due to a path traversal vulnerability in DJL’s archive extraction tools. Versions 0.1.0 through 0.31.0 are affected by this vulnerability, which may result in data corruption or illegal system access. Version 0.31.1 has a patch for it.
  • CVE-2022-42003, Jackson Library: Unsafe serialization/deserialization configurations in the well-known JSON parser cause a high-severity problem (CVSS 7.5) that could result in denial-of-service attacks.

These illustrations highlight how crucial it is for open-source libraries to have careful dependency management, frequent updates, and security audits. Companies should enforce stringent validation and use automated vulnerability scanning tools.

Click through for a more detailed view of a third CVE, as well as tips to protect your data.

Comments closed

Loading Excel from SQL Server via Power BI XMLA

Jared Westover doesn’t want to share:

Users want to pull data from tables in an Azure SQL database into Excel via Power Query. This situation sounds simple. However, I don’t want to provide direct access to the database for several reasons, including the potential governance and permissions nightmare. We have a Fabric workspace, and most of the data already exists in Power BI reports. How can we give users access to the data they need without providing direct access to the database for an easy SQL export to Excel?

Click through for the answer. This solution is a bit more roundabout than granting direct database access, but also comes with a host of security benefits.

Comments closed

Reviewing Two Explain Plans in PostgreSQL

Semab Tariq talks query tuning:

Performance optimization in a production database is crucial, but over-optimizing can complicate things without real improvements.

In this blog post, I’ll share two very basic EXPLAIN ANALYZE outputs from a production system. A user asked us to help optimize these plans (I’ve changed the table and column names for privacy).

We will look at how to spot slow parts of a query, improve performance the right way, and avoid unnecessary tuning.

One of the things you eventually learn as a performance tuner is that sometimes, it’s best not to try to optimize a particular query. This may seem a bit contradictory–who doesn’t want to go faster? But there are costs to actions, and spending a long time tuning an ad hoc query that somebody ran one time and probably won’t run again isn’t worth it. Ultimately, know how to tune, but also when to tune and what will give you the biggest marginal benefit.

Comments closed

Binding a Power BI Report to a Separate Semantic Model via Power BI Studio

Gilbert Quevauvilliers makes use of a Gerhard Brueckl extension:

The default option to rebind a Power BI report is to use the Power BI REST API.

This works well, but for a lot of people this can be quite intimidating.

Fortunately, Gerhard Brueckl, has created the amazing Power BI Studio, which is a Visual Studio Code Extension.

Click through to see how to install it and how to use this extension to rebind an existing Power BI report to a different semantic model, whether in the same workspace or even a different one.

Comments closed

Comparing INSERT INTO and SELECT * INTO

Haripriya Naidu runs an experiment:

Instead of looking at which option is faster, you may want to look at which option is better suited for a given context. Let’s take a look at 2 common options to insert data and analyze them.

INSERT INTO TARGETTABLE
SELECT * FROM SOURCETABLE

OR

SELECT * INTO TARGETTABLE 
FROM SOURCETABLE 

Click through for a comparison of the two, not just for which is faster but also the pros and cons of each approach.

Comments closed