Getting Crazy with Analytic Functions and Group By

This topic has been sitting in my backlog for a long time and I finally decided to write it. Analytic functions are not so new anymore (they’ve been around since Oracle 8i), but they are still a very powerful tool.

This is based on a real case I had quite a few years ago. A client came to me with a question regarding a graph they had to generate.

Continue reading “Getting Crazy with Analytic Functions and Group By”

Oracle Challenge #3 – SQL

I debated quite a lot before writing this post. When I wrote the post about interviewing a DBA, in the “technical questions I do ask” part I just gave a general explanation of what I ask, but didn’t reveal the real questions. Now, more than 3 years later, I decided to give one of the questions as a challenge here.

Continue reading “Oracle Challenge #3 – SQL”

Tool to Assist with Basic SQL Analysis

I just came back from RMOUG Training Days conference. It was my first time in Colorado (and obviously my first RMOUG training day) and it was really great (I wrote about it in another post).

During my second session (From 4 Minutes to 8 Seconds – about a real SQL tuning case I had quite a few years ago), I mentioned that one thing that I usually do when I see a query and need to analyze it, is to take a piece of paper and draw the tables and relations between them. When I later look at the execution plan and try to understand what Oracle does, it helps a lot if I know the structure of the tables. There is a big difference between queries built like a “star” (a single table in the middle, while the others are joined to it) or a “line” (each table is joined to the next one), or any other structure.

Continue reading “Tool to Assist with Basic SQL Analysis”

Order of Predicate Execution #1

In my previous post, I wrote about the parsing operation and what happens first. In the footnote I said that the order doesn’t affect performance, the cost based optimizer doesn’t care about the order of stuff in the query, right? Well, not quite.

Continue reading “Order of Predicate Execution #1”

Did You Know #22 – Reproduce SQL Issue

During OOW17 a customer ran into a wrong result issue in 11.2.0.4, which is very bad. I diagnosed this and found out that it happens because of bloom filter, so we just disabled that and it was solved. But I still opened an SR so Oracle can find and fix this bug.

Continue reading “Did You Know #22 – Reproduce SQL Issue”