anyone use mysql proxy?

I’ve always been interested in this product, maybe today is the day I try it.

MySQL Proxy is a simple program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication. Its flexibility allows for a wide variety of uses, including load balancing; failover; query analysis; query filtering and modification; and many more. Installation and build instructions are in the source archive below (mysql-proxy-X.X.X.tar.gz)

do views increase performance?

I’m a huge fan of views. I’m always understood that queries that hit a view are rewritten into simpler SQL Statements, but I wanted to demonstrate some examples where hitting a view is ~100 times faster than hitting the base tables.

In this situation, the view ‘vw000022010’ is a union of a bunch of different partitions (one partition per STATE).

This is a small snippet of the view definition (limited to two states for demonstration purposes, but the real view has 50 UNION statements)

SELECT ‘ak’ AS State, F1 AS FILEID, F2 AS STUSAB, F3 AS CHARITER, F4 AS CIFSN, F5 AS LOGRECNO, F6 AS P0020001, F7 AS P0020002, F8 AS P0020003, F9 AS P0020004, F10 AS P0020005,
F11 AS P0020006
FROM ak000022010 WITH (NOLOCK)
SELECT ‘al’ AS State, F1 AS FILEID, F2 AS STUSAB, F3 AS CHARITER, F4 AS CIFSN, F5 AS LOGRECNO, F6 AS P0020001, F7 AS P0020002, F8 AS P0020003, F9 AS P0020004, F10 AS P0020005,
F11 AS P0020006
FROM al000022010 WITH (NOLOCK)

Notice how the first column is a constant state = ‘ak’.

Now notice how querying that CONSTANT is 99x faster than querying the raw data– primarily because the SQL optimizer is smart enough to say ‘oh, I only need to check this one partition’.

You just can’t do this with stored procedures.  Views are magical magical inventions.. they are BETTER at rewriting SQL, because you can add constants, etc

select G.County, D.*
From vw000022010 D
inner join AAP_Geography.dbo.DimGeography G
and g.STUSAB = D.state
and g.sumlev = ‘050’
and D.state = ‘AK’

select G.County, D.*
From vw000022010 D
inner join AAP_Geography.dbo.DimGeography G
and g.sumlev = ‘050’
and D.state = ‘AK’


This is just my first example, I will try to write up my 2nd example soon (querying view ‘passes through’ other queries).  For this other topic, I was amazed to see how much faster a view was than a dump of the views, even after adding some indexes.

Micron's new terabyte-class SSD is under $600

What’s amazing to me is how much we accomplished with AWFUL hardware 10 years ago.  I used to work on a 5tb database at Microsoft on a Pentium3… when I got there, users were writing SQL and waiting an hour.. Moving to cubes changed most lookups to sub-second.

One of these days, I’d like to have some benchmarks, SQL Server vs JET.. I’m absolutely certain that we could make SQL Server run faster than Jet simply by using different harddrives for data vs indexes.

Micron Technology today announced a terabyte-class solid-state drive for under $600.

The 2.5-inch 960GB Crucial M500 SSD will be initially priced under $600, Micron said today.

The M500 solid-state drive uses a SATA 6-gigabit-per-second controller to deliver up to 80,000 input/output operations per second (IOPS).

The drive’s sequential read and write speeds reach up to 500 megabytes per second (MB/s) and 400 MB/s, respectively.

Drives in the 2.5-inch form factor will be available in 120GB, 240GB, 480GB and 960GB capacities. The smaller M.2 and mSATA form factors will be available in 120GB, 240GB and 480GB capacities.

The 2.5-inch Crucial M500 SSD is expected to be available for purchase in the first quarter of 2013. The M.2 and mSATA form factors are expected in the second quarter.$600/

SQL Compression – sp_estimate_data_compression_savings stored procedure is available only in the Enterprise, Developer, or Datacenter

I don’t get it.
There’s this feature – called Compression… that is like FANTASTIC for SOME of the times when you absolutely need more space (and can’t get more disk).

What I don’t understand is this- why can’t STANDARD edition at least ESTIMATE_COST_SAVINGS??

I understand that they want to COMPRESSION an enterprise-only feature.. but the ESTIMATE? That’s like saying ‘we can’t tell you how much money you’ll save until you actually buy the product’.

The sp_estimate_data_compression_savings stored procedure is available only in the Enterprise, Developer, or Datacenter editions of SQL Server 2008 and SQL Server 2008 R2.

WHY OH WHY OH WHY OH WHY is it so hard for them to understand that MAYBE if I could DEMONSTRATE COST SAVINGS- I should be able to create these estimates based on standard edition?  (Isn’t that one of the primary reasons to upgrade to Enterprise Edition?).

I’ve had many many clients buy Enterprise Edition because they think that it magically makes everything run faster.  When _I_ spent $25 grand per processor, I like to make sure I understand the features / requirements before doing so!

I love Visual Basic

I swear, 10 years ago.. VB was incredibly popular.  Microsoft invented some new language.. but I refuse to use it primarily because of two things:

a) Case Sensitivity – it’s just STUPID for languages to be case sensitive, sorry…

b) Most people claim that C# ‘pays better’ -that’s not a reason to use C#, that’s a reason to use VB!!

Well here’s a great article I found that lists 10 reasons that VB is cooler than C#, had to share!

10 Reasons Why Visual Basic is Better Than C#

07 March 2012

by Andy Brown

After having converted a whole lot of training materials based on VB.NET into C#, Andy ‘Wise Owl’ Brown decided to write a tongue-in-cheek rant whilst he could still remember the pain-points. ‘Convert to VB.NET! You have nothing to lose but your semi-colons! ‘

Visual Basic is a better programming language than Visual C#. Who says so? This article! Here are 10 reasons why you should always choose VB over C#.

1 – “Rose is a rose is a rose is a rose”

This is a quotation from Gertrude Stein’s 1922 play Geography and Plays. However, the poetry wouldn’t work in C#, because – unforgivably – it’s a cASe-SeNSitIvE language. This is madness!

Before I start ranting, let me just acknowledge that case-sensitivity confers one (and only one) advantage – it makes it easier to name private and public properties:

Writing properties like this means that you can refer to the public Name property, and it’s obvious what the private equivalent will be called (name).

// private version of variable
private string name = null;
public string Name
return txtName.Text;
name = txtName.Text;

So now we’ve got that out of the way: case-sensitive programming languages make everything else harder. Why, you ask?

  • You keep having to switch between upper and lower case when typing, causing RSI in your poor little fingers as you reach for the inconsiderately located Shift key.
  • You are much more likely to make mistakes – are you sure you meant to type DateOfBirth, or should it have been dateofbirth?
  • When you accidentally leave Caps lock on, it really matters.

The only possible benefit is that you can use more combinations of variable names, that is, you can use more of one of the few infinite resources in this universe…

It doesn’t matter if you disagree with everything else in this article: case-sensitivity alone is sufficient reason to ditch C#!

2 – The Switch clause

Both VB and C# contain a way of testing mutually exclusive possibilities, the Select Case and Switch clauses respectively. Only one of them works properly.

A Visual Basic Select Case clause, returning a description of how old someone is. The age range for a young person is a tad generous, reflecting the age of the author of this article.

A Visual Basic Select Case clause, returning a description of how old someone is. The age range for a young person is a tad generous, reflecting the age of the author of this article.

Select Case AgeEntered

Case Is < 18
txtVerdict.Text = “child”
Case Is < 50
txtVerdict.Text = “young person”
Case Is < 65
txtVerdict.Text = “middle-aged”
Case Else
txtVerdict.Text = “elderly”

End Select

You can’t do this using Switch in C#, as – astonishingly – it can’t handle relational operators. You have to use an If / Else If clause instead. But even if you could, you’d still have to type in lots of unnecessary Break statements:

switch (AgeThreshold) {
case 18 :
txtVerdict.Text = “child”;
case 50 :
txtVerdict.Text = “young person”;
case 65 :
txtVerdict.Text = “middle-aged”;
txtVerdict.Text = “elderly”;

It’s easy to forget to type in each of these Break statements!

3 – Event-Handling code

This is specific to Visual Studio (I’m using 2010, the latest version). Suppose I want to attach code to anything but the default Click event of a typical button:

Let’s suppose that I want to attach code to the MouseHover event of this button.

I can do this in Visual Basic without leaving the code window:

a) First choose the object from the drop list.


b)Then choose the event you want to code.

In C# you can’t do this – you have to return to the button’s properties window and choose to show its events:

You can double-click to attach code to this event for the selected button – but that’s the only simple way to create it for C#.

But it’s even worse than that. If you then rename a control (in this case btnApply) you have to re-associate the event-handler with the renamed control in the properties window (or in the initialisation code, if you can find it). In Visual Basic, of course, you can do all of this in code:

Private Sub btnApply_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnApply.Click


End Sub

Globally change btnApply to the new button’s name in code, and everything will work as before.

4 –Stupid symbols

C# was written by academics. It shows. Consider this table of C# symbols and their VB equivalents:

What you’re trying to do

C# Symbol

VB Equivalent

Test if two conditions are both true



Test if one or other condition is true



Test if a condition is not true



Concatenate two strings of text



Test if a condition is true within an if statement



Which column looks like it was designed by a real person?

5 – Autocorrection in Visual Basic actually works

IntelliSense works much better for Visual Basic than for Visual C#. Take just one example – creating a write-only property. Let’s start with Visual Basic:

When you press return at the line end…

WriteOnly Property PersonName As String

Set(value As String)

End Set

End Property

… You get this fully-completed clause.

For C#, the same thing doesn’t happen:

When you press return here, nothing happens (other than a blank line appearing).

This is just one example. I’ve just spent ages transcribing our VB courses into C#, and believe me, there are many, many more!

6 – Lack of supported functions

Here are a couple of functions I use from time to time in VB:


What it does


Tests if a value can be converted to a number


Calculates the annual mortgage payment for a loan

Great functions, but they don’t exist in C#.

7 – That wretched semi-colon

Why do I have to end every line in C# with a semi-colon? The argument used to be that it avoided the need to use continuation characters in Visual Basic:

MessageBox.Show( _
text:=”This article is a bit opinionated”, _

You used to have to use an underscore as a continuation character to show incomplete lines of code in VB.

However, as of Visual Basic 2010 you rarely need to do this anymore. Come on, C#: Visual Basic has ditched its line-ending character; why can’t you?(;)

Someone commented on my original (much shorter) blog about this:

“In a short amount of time you’ll type those semi-colons without thinking about it (I even type them when programming in visual basic).”

That’s like saying that you’ll soon get used to not having any matches to light your fire, and you’ll even start rubbing sticks together to start a fire when you finally manage to buy a box!

8 – Arguments and variables

The order of words in a C# variable declaration is wrong. When you introduce someone, you wouldn’t say, “This is my friend who’s a solicitor; he’s called Bob”. So why do you say:

string PersonName = “Bob”;

To me:

Dim PersonName As String = “Bob”

…is much more logical. I also find the C# method of having to prefix arguments with the word out confusing, particularly as you have to do it both in the called and calling routine.

9 – Strictness

C# is a much fussier language than Visual Basic (even if you turn Option Strict on in Visual Basic, this is still true). “And a good thing, too!”, I hear you cry. Well, maybe. Consider this Visual Basic code:

Enum AgeBand
Child = 18
Young = 30
MiddleAged = 60
SeniorCitizen = 90
End Enum

Select Case Age
Case Is < AgeBand.Child
Case Else
End Select

With Option Strict turned on this shouldn’t really work, as it’s comparing an integer with an enumeration – but VB has the common sense to realise what you want to do.

The equivalent in Visual C# doesn’t work:

A less forgiving language…

What this means is that you end up having to fill your code with messy type conversions:

The simplest way of converting an enumeration to an integer; but why should you have to?

// find out the age entered
int Age = Convert.ToInt32(txtAge.Text);

if (Age < (int) AgeBand.Child) {
} else {

10 – Redimensioning arrays

If you want to dynamically change the length of an array in Visual Basic, you can use Redim Preserve. To do the same thing in Visual C#, you have to copy the array, add a value and then copy it back:

The vile, clunky C# method of extending an array.

string[] PartyGuests = new string[2];

PartyGuests[0] = “Sarah Palin”;
PartyGuests[1] = “Richard Dawkins”;

// whoops! forgot to invite Mitt

// create a new extended array
string[] tempGuests = new string[PartyGuests.Length + 1];

// copy all of the elements from the old array into new one

// add Mitt as last element
tempGuests[PartyGuests.Length] = “Mitt Romney”;

// restore full list into original array
PartyGuests = tempGuests;

// check works
foreach (string Guest in PartyGuests) {

This epitomises Visual C# for me. Critics will tell me that:

  • Behind the scenes, the Redim Preserve command does exactly the same thing as the C# code above; and
  • I should be using lists and not arrays anyway.

That’s hardly the point! The point is that – as so often – Visual Basic makes something easier to code than C# does.


So those are my 10 reasons to code in Visual Basic. What are you waiting for, all you C# code-monkeys? Convert all of your code to VB – you have nothing to lose but your semi-colons!


batteries are going bluetooth

Tethercell magically turns AA batteries into Bluetooth devices

Traditional batteries may never be the same again since Tetherboard displayed its working Tethercell prototype at CES 2013. It embeds Bluetooth into a traditional AA battery form.

Amanda Kooser
by January 8, 2013 12:11 AM PST
Tethercell componentsOh, look, there’s a Bluetooth in your battery.

(Credit: Amanda Kooser/CNET)

LAS VEGAS–What happens when you put a couple of SpaceX engineers together with some old-school batteries? You get a new-school approach to battery power. Tetherboard calls the Tethercell “the world’s first app-enabled smart battery.” Wait, don’t fall asleep, this is actually pretty cool.

A Tethercell battery is the size of a regular AA battery, but it holds an AAA battery inside its little case. It also holds a Bluetooth chip inside the case. Think of it as a battery turducken. This means you can use your smartphone to control the battery. Oh the power. You can turn off little Billy’s toy guitar when you want to take a nap. You can disable your spouse’s remote control when you can’t stand another second of mindless channel-flipping. You can even set hours when a device can be used.

Basically, Tetherboard is dragging old devices kicking and screaming into a new age of smartphone control. Take that, Teddy Ruxpin. This could also be a life-saver for parents who unwisely bought their kids Furbies. On a more practical front, the Tethercell could eventually be used to warn you when a battery is about to run out of juice, saving you from your smoke alarm’s obnoxious low-battery wails at 4 in the morning.

When you change out a AA battery for a AAA battery, you will be sacrificing some capacity. Using the Tethercell in a device with multiple batteries helps to minimize this impact to battery life.

Tetherboard showed off a working prototype of the Tethercell at CES 2013. The company is currently talking with investors and tweaking the Tethercells to go into production. Pre-orders should be starting within a few days.

Right now, it costs around $20 for aTethercell battery, but with economies of scale kicking in, Tetherboard hopes to get that under $10. Trust me, it will be worth it just to get that Furby to shut up.

Internet Explorer usage up about 5 percent this year

Microsoft’s Internet Explorer (IE) turned things around in 2012, posting an annual usage share gain for the first time in the last eight years, according to data published earlier this week by a Web analytics company.

Net Applications, which tracks browser usage by monitoring unique visitors to customers’ websites, said IE ended 2012 with a 54.8% share, up 2.9 percentage points from the start of the year.