Press "Enter" to skip to content

Day: June 29, 2021

Comparing Property-Based and Partition-Based Testing

Mark Seemann compares and contrasts two types of testing which typically get conflated:

To be fair, the overlap may easily be larger than the figure implies, but you can certainly describes properties without having to partition a function’s domain.

In fact, the canonical example of property-based testing (that reversing a list twice yields the original list: reverse (reverse xs) == xs) does not rely on partitioning. It works for all finite lists.

You may think that this is only because the case is so simple, but that’s not the case. You can also avoid partitioning on the slightly more complex problem presented by the Diamond kata. In fact, the domain for that problem is so small that you don’t need a property-based framework.

This is an interesting look at two related but separate branches of testing.

Comments closed

Finding Eager Index Spools

Erik Darling hunts the most dangerous prey of all:

I’ve written a bunch about Eager Index Spools, and how to fix them, but I’ve always sort of left the “finding” part up to you, or pointed curious tuners to tools like sp_BlitzCache.

Recently though, I worked with a client who had Eager Index Spools so frequently that we needed to track them down specifically.

This is the plan cache query that I used to do it — they didn’t have Query Store enabled — and I wanted to share it.

Click through for the query.

Comments closed

Using the Cosmos DB Integrated Cache

Hasan Savran makes use of a cache:

We are ready to write some code now. Integrated Cache works only in Eventual Consistency for now. So, we need to send requests in Eventual consistency to test the Integrated Cache. To do that, we need to use requestOptions parameter in SDK. You can change your database consistency level to Eventual too for testing if you like. Don’t forget to change it back later!

Hopefully that limitation changes later, but in the meantime, click through to see how to use the integrated cache in Cosmos DB.

Comments closed

Creating Comparisons in Power BI

Matt Allington has a video:

The whole concept here is to allow a user to pick two things from a list and compare them with each other. For example, compare

– Any year with any other year
– Any product against any other product (maybe even a group of products, using multi select)
– Snapshots (eg different versions of a financial forecast) with any other version
– Etc

What is possible is endless, and the good news is that it is pretty simple to do this in Power BI. Check out my video below to see how I did it.

Click through for the video.

Comments closed

Levels of Recursion in CTEs

Steve Stedman probes the limits:

When presenting unleashing Common Table Expressions at SQL Saturday a while back, I was asked a couple of great questions that I didn’t know the answer to. So I did the research and tracked it down:

1. How many levels of recursion can you have in a CTE?

2. How many levels of nesting can you have in a CTE?

So I started doing the research and doing some testing to figure it out.

How many levels of recursion can you have in a CTE?

Click through for the two answers.

Comments closed