The SQL optimiser processing has been refined over a number of years and is probably one of the best optimisation systems, based on the Cascade approach, of all the database implementations available today. The optimiser makes a very good job of removing any problems, poor SQL coding and works out the best, most of the time, way to execute the statement. I also learned that unless you really know the internals of what is happening then it is best to let it do its own thing. You can selectively disable certain rules if you want to play or are an expert but that is something I do not plan an tampering with.
SQL Server looks like it will be a very nice product to play with and use but it is not perfect. The dynamic help we all use and love in say 2008 has been ‘removed’ and the replacement is not as good. The new Analysis Functions are also a mixed bag. Don’t try to find the help entry for them; it doesn’t exist in the index. It is there however and can be found via the OVER clause description and navigating from the links at the bottom of that entry. They do allow for an easier way to find the median of a set of values and running totals have finally been catered for. Many of the functions do not seem that useful but then again it is not the kind of result sets that I have ever been interested in, I suspect there are those that will love them and there is a whole new book dedicated to just these new additions.
Also interesting this week was the release of the notes from Alan Turing that lead to the breaking of the Nazi Enigma codes that brought World War 2 to a close a couple of years earlier. The info is not available online as yet but public access is available to those who ask at the UK National Archive. A couple of typed pages with handwritten formulae outlined the code breaking techniques. A bright man Mr Turing.
SQL Notes
One command I had never used before, but one that would have been very useful a few months ago, is the MERGE command. It turns out not only to be quite powerful but quite versatile.
A sample command looks something like the following:
MERGE Customers T
USING CustUpdates S
ON C.CustCode = S.CCode
WHEN MATCHED THEN
Update
WHEN NOT MATCHED THE
Insert . . ..
The example above has the Customers master file as the target with a Customers Update table that may or may not have a record for every existing member and perhaps a few new ones.
If the source file finds a match in the target file based on the assigned customer number then the Update command is applied. If it is a new code then an Insert is processed adding the new entry to the Customers table. The command works in a kind of batch mode instead of a line by line process that an alternative would do using say SELECT statements, i.e. the way I used to do it.
If the Insert statement say adds a incrementing ID and you want to see them then adding:
OUTPUT action$, deleted.*, inserted.* will list the action (update, insert) along with the before and after fields for each record. Unlike other examples of the OUTPUT command you can have it provide fields from the tables.
Imagine the above command surrounded by brackets as a sub-select and an INSERT added outside based on some conditions to say implement versioning or an audit trail of the MERGE results. It gets quite powerful and is more efficient than other options.
The lesson I took away is that the SQL Microsoft team is adding new functionality at the SQL level in every new version and it is worth spending some time to learn what the new functionality gives or saves the programmer.
Industry News
It’s semi-official, Windows 8 will be signed off on by Microsoft and released to OEMs in June with an expected public launch in either September or October. Windows chief Steven Sinofsky made the announcement at Windows 8 Dev Days in Japan. Tweets promptly followed. This release is normally called the Windows release to manufacturing (RTM) code and signifies the ‘final’ version but now known as now a "release preview". Microsoft loves changing the names of things to keep the punters guessing. Of course by not calling it the RTM then they technically have the option to delay the final release if there are too many bugs found by the gamma testing done by the PC manufacturers.
Apple’s shiny new tablets are made in China. The reason for this may seem obvious, cheap labour and no safety or worker concerns. There is however an even better reason, rare earths. China has implemented a set of new policies on the export of rare earth minerals, vital for new electronics devices from phones to tablets. China has an apparent monopoly on rare earths at the moment. Apple’s devices need them so the company is now essentially trapped in China for manufacturing.
Apple is not telling but experts suggest they need lanthanum for the lithium-ion polymer battery. Neodymium alloy for magnets and a number of other rare earths to make the wide range of display colours. SO making them in China means access to the materials and a nice cut in costs. Until there are viable alternatives China is king.
Finally some nanotechnology I can get behind. Scientists in University of California and in Taiwan are suggesting that nanosized CMOS memory based on nanodots are not that far away. The dots work at 10 to 100 times faster than current RAM and use current technology compatible manufacturing techniques.
One of the more interesting mathematical problems is how to generate random numbers. To date there has not really been a true random number generator. Enter the real of the quantum level. Take a laser and find a way to measure the fluctuations in the vacuum field contained in the radio-frequency sidebands. Or put another way find a way to take readings of the vacuum fluctuations at the quantum level. Then turn these into a series of random numbers. Next post a real time feed on a site, http://150.203.48.55/index.php#. All this from the Australian National University. Who knew that they could actually do real science there? The data stream is robust, immune to environmental fluctuations, and they can support up to 2 Gbps of real time random number generation. Pretty cool actually.