Category: SQL

3

Clustering a Table on an Index

I have been playing a fair amount lately with clustering indexes and have been rehashing my views on reorging tables on an index. This is still a work in progress, but thought I’d share some details and see if others out there have any thoughts to share with me and others on it. Clustering a Table on an Index I’ve...

2

Three Different Ways to Write the Same Join in SQL

This was really a revelation for me when I took DanL‘s SQL workshop before the IDUG conference in Phoenix. I started out as a physical or systems DBA at IBM, and until studying for certification, I hardly wrote a statement more complicated than select * from syscat.bufferpools. After being a DBA for probably 5 years or more I started to...

3

DB2 Basics: Capitalization

When does case matter in DB2? Well, it doesn’t unless it does. Nice and clear, huh? When Text Must be in the Correct Case Text must be in the correct case whenever it is part of a literal string. Things that you have to enclose in single quotes are case sensative. select * from table where col1=’text’ is different from...

9

Redesigning Tablespaces in an Existing Database

Like many applications, WebSphere Commerce puts all tables in USERSPACE1 unless they need larger page sizes. This actually works just fine for smaller and midrange implementations, but we have about one build a year that requires something else – either because of standards that client DBAs adhere to or because they actually are busy enough for I/O and separate buffer...

3

The Danger of FETCH FIRST ROW ONLY

There are a a vast array of things you can do in SQL. But just because you can doesn’t always mean that you should. I recently ran into an interesting situation with FETCH FIRST ROW ONLY. How the Problem Manifested The day after new code was deployed, a production database system that usually runs with 40% CPU utilization or less...

5

Using a Statistical View to Improve Query Performance

Sometimes just using the index advisor and a bit of common sense, you can address SQL performance issues. But other times, you have to dig a bit deeper. I recently found the following query and 300 of its closest cousins (differing only in the length of the second in-list) were eating 30% of the CPU time used by queries on...

6

Using an Event Monitor to Capture Statements with Values for Parameter Markers

Recently, I needed to do some SQL profiling – discovering exactly what SQL a web application was executing against the database. I learned a lot, and when I learn a lot, I try to share with my readers. I went into this exercise with two major misconceptions: A statement event monitor would collect parameter marker values Event monitor table output...