Author Archive

MySQL Memory Usage Profile Script 2

By Tim Procter April 19th, 2007 at 11:13 am
Posted in Group Blog PostsMySQL

Here is the perl script referred to by mysql-memory-usage-profile.

Downloadable: mysql_memory_profile.pl

(more…)

MySQL Memory Usage Profile Script

By Tim Procter April 18th, 2007 at 2:43 pm
Posted in Group Blog PostsMySQL

There are various tools available for gathering and monitoring mysql performance data, but it’s not always clear what they mean, what is important, and what can be tuned. I’m not going to try to post a comprehensive mysql tuning manual here. This post is about taking a snapshot profile of a mysql instance that will allow you to define what type of instance you are dealing with, and give you some idea about whether the current configurations are stable or not. (more…)

Oracle: Deleting Duplicate Rows Efficiently

By Tim Procter May 23rd, 2006 at 2:12 pm
Posted in Group Blog Posts

Finding duplicates with RANK
If you’ve made the mistake of forgetting a primary key on your table, it can be frustrating to find a way to delete all of the duplicate rows without deleting the initial instances.

delete from $table_name where rowid in
  (
  select "rowid" from
     (select "rowid", rank_n from
         (select rank() over (partition by $primary_key order by rowid) rank_n, rowid as "rowid"
             from $table_name
             where $primary_key in
                (select $primary_key from $table_name
                  group by $all_columns
                  having count(*) > 1
                )
             )
         )
     where rank_n > 1
  )

This query selects all of the ‘extra’ rowids and removes them. It is especially designed for limiting the query scans to only those records which have duplicates, which is useful if there’s only a subset of the table that you are dealing with. If you want to improve its efficiency for a table with a high percentage of duplicates, simply remove the inside where clause. In a sample test with 1% duplicates and 233 000 rows, the query took 22 seconds without the subquery, and 18 seconds with it.

(more…)

Pythian Celebrates Re-implemention of Industry News

By Tim Procter February 23rd, 2006 at 1:20 pm
Posted in Pythian

Pythian News is now using WordPress to transform our Industry News section into a group blog of articles relevant to the DBA community at large. We hope this will allow readers from throughout the DBA industry to get involved and not only view our blogs, but also be able to contribute to the discussions.

For convenience, archived old Industry News articles have been added to the blog below as authored by Paul Vallee, our President. Future articles will follow the blog writing philosophy more closely!