Posts Tagged ‘SQL Server’

Log Buffer #96: a Carnival of the Vanities for DBAs

Friday, May 9th, 2008

This is the 96th edition of the weekly review of database blogs, Log Buffer.

Let’s start this one in SQL Server Land, with a question from Dennis Goboshould SQL Server have the CREATE [OR REPLACE] PROCEDURE syntax? There are, he writes, advantages: “When scripting out a database you don’t have to generate if exists…..drop statements,” and disadvantages: “I can overwrite a proc without even knowing it.” Of course, the commenters have opinions of their own, and the piece becomes a straw poll for the desirability of that syntax as a feature.

Aaron Bertrand has one too: when was my database/table last accessed? Writes Aaron, “SQL Server does not track this information for you. SELECT triggers still do not exist. Third party tools are expensive and can incur unexpected overhead. And people continue to be reluctant or unable to constrain table access via stored procedures, which could otherwise perform simple logging.” He looks at 2008’s built-in auditing, and for those who can’t wait for that, illustrates a workaround for 2005.

Linchi Shea explores something else from 2008, Page Compression, focusing on how the number of processors affects the rebuilding a table with page compression.

Jamie Thomson, the SSIS Junkie writes that he has made a submission to Connect on the matter of absolute and relative paths in SSIS. “. . . I have always agreed that stipulating the use of absolute paths within SSIS was the right thing to do (and indeed I have championed it) however of late I have changed my mind. Support for relative paths would greatly simplify package deployment and package management . . . What do you think? Should SSIS support relative paths?” So far, it looks like a shoo-in.

Brian Knight also explains another little quirk, SSIS Case Sensitivity: “The case sensitivity can in some cases create behavior that is not expected and may give you bad results if you’re not careful.  . . . One such example is with the Lookup Transform, where comparisons against the cache are case sensitive. If you do not expect this, you may have a miss in a match that is actually a hit.”

In the MySQL ’sphere this week, there is plenty of talk about the openness or otherwise of MySQL. (more…)

Log Buffer #95: a Carnival of the Vanities for DBAs

Friday, May 2nd, 2008

The 95th edition of Log Buffer, the weekly review of database blogs, has been published by Mark Schoonover on his Mark’s IT Blog.

We can look forward to LB#98 Jeff Smith’s Jeff’s SQL Server Blog on May 23rd. There’s always plenty of room for more editors, so don’t waste another minute — send an email to me, the Log Buffer coordinator, and get started!

Without further ado, here is Mark Schoonover’s Log Buffer #95.

Log Buffer #94: a Carnival of the Vanities for DBAs

Friday, April 25th, 2008

Log Buffer, the weekly review of database blogs, welcomes back for his record-breaking record-tying (Sheeri, are you reading?) third edition Ronald Bradford of Opinions, Expertise, Passion.

Why does Ronald write Log Buffer? Perhaps it’s because he knows that LB is and established and widely read feature, and hence likely to bring his own blog some new readers and improve its ranking. Or maybe he enjoys the fun and challenge of comprehending and presenting the entire DBA blog scene, not just the part that deals with his own favoured technologies. (Or maybe he just likes me? Ronald?)

Since Log Buffer is open to anyone, I encourage you also to join in. If you’d like to edit and publish an edition yourself, take a look at LB’s homepage, read the few guidelines, and then get in touch with me, the Log Buffer coordinator.

You can also contribute by emailing your favourite blog items to the editor.

And now, here’s Ronald Bradford’s Log Buffer #94.

SQLTeach Toronto: Almost Here

Tuesday, April 22nd, 2008

I was just reviewing my calendar for the next several weeks and noticed that the Toronto SQLTeach conference is now only a few weeks away.  This conference includes quite a few interesting SQL Server-related sessions, on topics ranging from best practices, to performance, to some of the new SQL Server 2008 features. I fully expect this to be a great show.

I am doing two breakout sessions during the main conference:

  • “SQL Server 2005: Authorization, Privilege, and Access Control”.  In this talk I cover SQL Server 2005’s enhancements around granting permissions via stored modules (i.e., stored procedures, views, functions)
  • “Designing Highly Concurrent Database Applications”.  In this talk I get into the business requirements behind supporting concurrent processes, and the areas where SQL Server (and every other database product) falls short. I then go on to show how to solve the problems in the database programmatically.

I am also doing a full-day post-conference session on SQLCLR programming. This will be the first time that I will be presenting all of my SQLCLR material in a single day; should be fun. I will take attendees from the basics all the way through some advanced applications and techniques, so if you’re interested in becoming a SQLCLR expert I highly recommend attending.

The conference starts in just three weeks, but it is not too late to register.

Log Buffer #93: a Carnival of the Vanities for DBAs

Friday, April 18th, 2008

Welcome to the 93th edition of Log Buffer, the weekly review of database blogs.

Conference season is upon us, so it’s been a busy week. There was the MySQL Conference & Expo, so let’s look at that.

Arjen Lentz posts about Sunday’s community dinner, including the arrival of an unexpected guest. Two photos: one of Pythian’s Paul Vallée getting some Sun; the second from the pre-conference dinner.

Zack Urlocker has a couple pieces with both photos and links to video of the keynote addresses from Marten Mickos, Jonathan Schwartz, and Rich Green. From Wednesday, and from Thursday.

Congratulations are due to Baron Schwartz, Diego Medina, and Sheeri Cabral. Baron reports from the conference that the three of them were awarded the 2008 MySQL Community Awards, and his piece makes for a very apt acceptance speech. Here’s Kaj Arnö’s more official post on the Community Awards.

Baron also has good summaries of the conference course: day one, and day two.

Elsewhere on the MySQL scene, much ado about the immediate roadmap for the DBMS, as introduced at the conference. Jeremy Cole got things going, writing, MySQL to launch new features only in MySQL Enterprise: “MySQL will start offering some features . . . only in MySQL Enterprise. This represents a substantive change to their development model — previously they have been developing features in both MySQL Community and MySQL Enterprise. However, with a shift to offering some features only in MySQL Enterprise, this means a shift to development of those features occurring . . . only in MySQL Enterprise.” This post got a lot of comments, including from MySQL boss Marten Mickos.

(more…)

SQL Server Procedure Cache: More Relief on the Way

Tuesday, April 15th, 2008

If you’ve read many of my blog posts, you know that I consider lack of procedure cache control to be a major SQL Server pain point. Badly written apps that use non-parameterized ad hoc queries can quickly flood SQL Server’s memory pools and bring the server to its knees.

SQL Server 2005 brought some relief in the form of the Forced Parameterization database option, and SP2 took things one step further with better throttling of the cache… but it’s still not enough. We want a knob!

The bad news: We’re not getting quite the knob I was hoping for.

The good news: SQL Server 2008 will include an sp_configure option called ”optimize for ad hoc workloads“.  This option will cause the procedure cache to only cache the parameterized stubs for ad hoc queries, rather than the full query with parameters.  This means that applications passing a large number of non-parameterized batches should see much lower procedure cache memory utilization and, therefore, better overall throughput.  I’m really looking forward to seeing this in action; this feature should be added with the next pre-release drop.

Remember, there is simply no substitute for properly designing your application’s data access layer, but hopefully this will help for those applications that simply can’t be changed…

SQL Server Query Processing Puzzle: LIKE vs ?

Tuesday, April 15th, 2008

How creative are you with manipulating your queries to produce more efficient plans? Try the following puzzle and e-mail your solution to me at [<my last name> @ pythian.com]. Make sure to include an explanation of why it works, as well as your mailing address. The best two solutions/explanations win a free copy of Expert SQL Server 2005 Development, a wonderful feeling of accomplishment, plus eternal fame and glory when I reveal your solutions here on the blog.

Run the following T-SQL to create two tables in TempDB:

USE TempDB
GO

CREATE TABLE b1 (blat1 CHAR(5) NOT NULL)
CREATE TABLE b2 (blat2 VARCHAR(200) NOT NULL)
GO

INSERT b1
SELECT LEFT(AddressLine1, 5) AS blat1
FROM AdventureWorks.Person.Address

INSERT b2
SELECT AddressLine1 AS blat2
FROM AdventureWorks.Person.Address
GO

Now consider the following query:

SELECT *
FROM b1
JOIN b2 ON
    b2.blat2 LIKE b1.blat1 + '%'

This query takes around three minutes to run on my notebook, and does over 1.8 million logical reads. Can you figure out a way to re-write it so that it performs better? No modification of the base tables or addition of any other objects is allowed (sorry, no indexed views!) — the challenge is to tune this by doing nothing more than re-writing the query.

Good luck! I’ll leave the contest open for submissions until May 1.

Log Buffer #92: a Carnival of the Vanities for DBAs

Friday, April 11th, 2008

Welcome, readers, to the 92nd Log Buffer, the weekly review of database blogs.

Brian “Krow” Aker started an interesting blog-thread with his post, The Death of Read Replication, the crux of which is that object caches, such as memcached, make the DBMS itself a little less central, particularly in “Web 2.0″ scenarios. “What does this mean? Less database servers. Bringing down your load means you push off the load to another tier. . . . Why do I need to go through MySQL at all… unless I just want it as a backup or for ad-hoc reporting?”

Ronald Bradford responds with an overview of the MySQL-plus-replication scene. Farhan Mashraqi concurred with Brian’s post, while Arjen also agrees, adding, “I’m not sure the new memory based MySQL storage engines coming out are so relevant, they might be fixing the wrong thing in the wrong place.”

Ronald (who, by the way, is on-deck for a his third Log Buffer on the 25th) also surveys both the storage-engine stuff to be had at the MySQL Conference, and the prevalence lately of talk about Kickfire in MySQL blogs, something also mentioned by Peter Zaitsev on the MySQL Performance Blog.

Peter has another question on his mind: should you have your swap file enabled while running MySQL? He wants to hear your approach to this matter, having himself experienced variable results. Lots of responses already.

Here on the Pythian Group Blog, Paul Moen posted about a situation in which SHOW SLAVE STATUS lies.

Moving into Oracle stuff, our Alex Gorbachev also pointed out something that doesn’t quite work: the ASMCMD cp command in ASM 11g. He sure gives it a try, but finally concludes: “I couldn’t make the cp command work even a single time.” Except maybe on datafiles.

(more…)

Log Buffer #91: a Carnival of the Vanities for DBAs

Friday, April 4th, 2008

Welcome to the 91st edition of Log Buffer, the weekly review of database blogs.

For a change, let’s begin with some PostgreSQL stuff. On Tending the Garden, Selena Deckelmann gives her retrospective thanks to those who attended and presented the PostgreSQL Conference East.

On Esoteric Curio, Theo Schlossnagle gives his thoughts on the keynote address by Joshua Drake, touching on the perennial versus, Postgres vs. MySQL.

Hey, there was a MySQL ambassador there, too — Baron Schwartz of xaprb. Here’s Baron’s recap of his experiences at the conference.

When pet projects bite back! reasserts that SQL is in fact a programming language. Sometimes one can forget that and need a little reminder. Or a not-so-little reminder, such as a three-pages-long query. The discussion ranges into questions of design, a matter that Baron Schwartz also pursues: he asks (on behalf of his wife), what is your favorite database design book? (I want to know too — um, for . . . a friend of mine.) Lots of good responses so far.

For huge queries to huge tables. On the MySQL performance blog, Aurimas Mikalauskas walks us through using MMM to ALTER huge tables. He writes, “When it comes to changes that really require table to be rebuilt - adding/dropping columns or indexes, changing data type, converting data to different character set - MySQL master-master replication especially accompanied by MMM can be very handy to do the changes with virtually no downtime.”

(more…)

Log Buffer #90: a Carnival of the Vanities for DBAs

Friday, March 28th, 2008

Welcome to the 90th edition of Log Buffer, the weekly review of database blogs.

First, SSQA.net’s SQL Master offers his walk-through of best practices for installing SQL Server 2005, with clustering as the destination.

If you read SQL Server blogs, you already know Adam Machanic. I’m very pleased to mention his first post for the Pythian Group blog, covering the basics of minimal logging and its enhancements in SQL Server 2008.

Also looking at Katmai was Bob Beauchemin, with his tip on accessing multiple servers with the SQL Server 2008 PowerShell provider, something right out in the open that nonetheless you might have missed.

Bob also figures out a little more about 2008’s new sparse columns and column_sets.

Joe Webb’s site mentions his appearance on Buck Woody’s Real World DBA podcast, where they tackle the question, does JOIN order matter?

On OraStory appears a very-commented post by Dominic Brooks, tantalizingly called, The dea(r)th of Oracle RDBMS and contracting?. From the piece: “I feel like the war has been lost and there are only a few pockets of resistance left now, resistance that will sooner or later be squashed. The database is under attack. . . . A newly created hierarchy have decreed that databases are indeed bad. . . . And I was speaking to a friend today at a previous employer, a major media / entertainment company. They are planning to abandon their pragmatic approach to Oracle and switch wholely [sic] to open source databases, ORM tools, and the like.”

And speaking of “Oracle versus X” (why doesn’t HTML have a <segue> tag?) — in last week’s LB#89, Shakir Sadikali criticized a post by Sean McCown’s Database Underground that compared Oracle and SQL Server to the latter’s advantage. Sean follows up the original piece, with this second item on Oracle’s community. He writes, “. . . one area I think Oracle has it over Microsoft is in its downloads. When I go to Oracle to download anything, all the downloads are clearly marked on a single page. Microsoft just isn’t like that. Sometimes even finding a service pack for SQL is like finding help for Oracle. . . . to those of you who said Oracle is easier to admin that SQL, you’re just crazy.”

(more…)