Friday, November 5, 2010

EXPRTYPE, DATEDIFF, MICROSECOND, BIGINT and Volker Barth

Some of the minor differences between Volker Barth and me are apparent in this photo (I'm the one on the right):



However, there is a much bigger, hidden difference between Volker and me: when Volker reads something, he remembers what he's read and is able to use it in his daily life.

Unlike me, apparently.

You see, Volker's read the "What's New" sections in the SQL Anywhere Version 12 Help. I know that because of his comment on this blog post about how DATEDIFF is now returning BIGINT as well as supporting the new MICROSECOND date part.

I also know that I also read all the What's New stuff in Version 12... I know that because, well, I had to, didn't I? In order to write 10 Cool New Features In SQL Anywhere 12?

Didn't I?

I'm sure I did :)

OK, That's 12, This Is Now


For those of you working with earlier versions of SQL Anywhere, and even those lucky enough to be running Version 12, the question sometimes arises, "What data type am I getting?"

Older Help files often don't tell you what data type is returned by a builtin function. For example, the Version 9.0.2 Help file doesn't tell you that DATEDIFF returns INTEGER.

Plus, you may have coded an expression and you need to know what the resulting data type is so that, for example, you're not getting an integer when you want three decimal places.

The EXPRTYPE function was introducted in Version 9.0.0 8.0.3 for just this purpose. You pass it a 'SELECT-statement-inside-single-quotes', plus a number 1, 2, 3 telling EXPRTYPE which SELECT list item you are interested in, and it returns a string containing the data type for that item.
exprtype() works with 8.0.3, though it is not documented there. FWIW, the 8.0.3 maintenance release did not have its own doc set, just a "Readme file" with the news and changes - and unfortunately, that made it newer than the official docs, and therefore even the v9-V11 docs don't list the changes from 8.0.3. – Volker Barth
Here's what EXPRTYPE says about DATEDIFF in 9.0.2 8.0.3:

SELECT ' Version:' AS "Date Part", @@Version AS "Data Type"
UNION
SELECT ' 1. YEAR', EXPRTYPE ( 'SELECT DATEDIFF ( YEAR, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 2. QUARTER', EXPRTYPE ( 'SELECT DATEDIFF ( QUARTER, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 3. MONTH', EXPRTYPE ( 'SELECT DATEDIFF ( MONTH, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 4. WEEK', EXPRTYPE ( 'SELECT DATEDIFF ( WEEK, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 5. DAY', EXPRTYPE ( 'SELECT DATEDIFF ( DAY, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 6. HOUR', EXPRTYPE ( 'SELECT DATEDIFF ( HOUR, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 7. MINUTE', EXPRTYPE ( 'SELECT DATEDIFF ( MINUTE, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 8. SECOND', EXPRTYPE ( 'SELECT DATEDIFF ( SECOND, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 9. MILLISECOND', EXPRTYPE ( 'SELECT DATEDIFF ( MILLISECOND, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
ORDER BY 1;

Date Part,Data Type
' Version:','8.0.3.5379'
' 1. YEAR','int'
' 2. QUARTER','int'
' 3. MONTH','int'
' 4. WEEK','int'
' 5. DAY','int'
' 6. HOUR','int'
' 7. MINUTE','int'
' 8. SECOND','int'
' 9. MILLISECOND','int'

Here's what it says about DATEDIFF in Version 12:

SELECT ' Version:' AS "Date Part", @@Version AS "Data Type"
UNION
SELECT ' 1. YEAR', EXPRTYPE ( 'SELECT DATEDIFF ( YEAR, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 2. QUARTER', EXPRTYPE ( 'SELECT DATEDIFF ( QUARTER, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 3. MONTH', EXPRTYPE ( 'SELECT DATEDIFF ( MONTH, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 4. WEEK', EXPRTYPE ( 'SELECT DATEDIFF ( WEEK, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 5. DAY', EXPRTYPE ( 'SELECT DATEDIFF ( DAY, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 6. HOUR', EXPRTYPE ( 'SELECT DATEDIFF ( HOUR, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 7. MINUTE', EXPRTYPE ( 'SELECT DATEDIFF ( MINUTE, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 8. SECOND', EXPRTYPE ( 'SELECT DATEDIFF ( SECOND, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT ' 9. MILLISECOND', EXPRTYPE ( 'SELECT DATEDIFF ( MILLISECOND, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
UNION
SELECT '10. MICROSECOND', EXPRTYPE ( 'SELECT DATEDIFF ( MICROSECOND, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 )
ORDER BY 1;

Date Part,Data Type
' Version:',12.0.0.2589
' 1. YEAR',int
' 2. QUARTER',int
' 3. MONTH',int
' 4. WEEK',int
' 5. DAY',int
' 6. HOUR',bigint
' 7. MINUTE',bigint
' 8. SECOND',bigint
' 9. MILLISECOND',bigint
'10. MICROSECOND',bigint

If you like EXPRTYPE, you'll love sa_describe_query().

Only in 12, though.

Wednesday, November 3, 2010

Product Suggestion: Improve ISQL - Tools - Index Consultant




Let's say you have some slow SQL that can't be run as a separate, single SQL statement but can only live inside a BEGIN block... let's say it's part of a stored procedure or web service or some such.

Furthermore, let's say you really really really really really need some help... you've followed the 64 Easy Steps described here and you've looked at graphical plans until your head hurts, and you still don't know what to do.

And then, let's say, you have an epiphany: "The Index Consultant will tell me what to do!"

So you grab your code and paste it into ISQL and fiddle with it until it runs... slowly, of course, because that's your problem... and then you press Tools - Index Consultant.

You've done that before, and it's worked, and the Index Consultant is WONDERFUL!

But not this time...




Instead of two clicks (Tools - Index Consultant), it wants you to use the Application Profiling feature in Sybase Central. I'm not sure how many clicks that would be (fifty? 64? five hundred?) because I haven't been able to get it to work. It either comes up empty or Sybase Central crashes.

Which brings me to this suggestion: ISQL - Tools - Index Consultant SHOULD WORK on batches as well as single statements.

Yes, I know, lots of folks can get Application Profiling to work for them. But (I'm guessing here) there's a larger group of people who have just given up. I'm part of that group, in fact I'm a serial surrenderer... every six months or a year I make a serious attempt to use Application Profiling, using Version 10, Version 11, Version 12, and every time it's the same.

I used to shout at the monitor, "Has nobody ever heard of usability testing?"

Now I just relax, sippa cuppa, get on with other things.

Dilbert.com

Monday, November 1, 2010

Database Tracing In English

The interweb has finally run out of storage space for images. Or, I've run out of patience pressing Alt + Print Screen.

Either way, this article is...

  • a text-only description

  • of how to get the query plan

  • in SQL Anywhere Version 11.0.1.2276

  • for a SQL statement

  • that lives inside a block of code...
...like an application, or a stored procedure, or a trigger, or something as simple as a batch in ISQL containing a cursor fetch loop.

It's not easy. It should be easy, because ISQL has a wonderful "Plan Viewer", but it's not; here's why:

There... is... no... plan...


For example, if you have a BEGIN block containing a FOR loop that runs just fine in ISQL, albeit slowly, when you try to run Tools - Plan Viewer on the whole block you get this message:
There is no plan for the SQL statement.
[Sybase][ODBC Driver][SQL Anywhere]Syntax error near 'DECLARE' on line 2
If, in foolish desperation, you highlight the FOR loop and try to run the Plan Viewer on that, you'll see a message like this:
There is no plan for the SQL statement.
[Sybase][ODBC Driver][SQL Anywhere]Plan can not be generated for this type of statement

Who knew?


But wait! There is a way! It's called Database Tracing! and it comes in the box with SQL Anywhere! (take THAT, evil Borg!)
Note: If I spoke German (I don't) this article could have been "Database Tracing In German". The specific language isn't important except for the fact it is NOT "Database Tracing In Hieroglyphs". In other words, all text, no pictures. "A picture is worth a thousand words" means words are necessary to explain what you are looking at. Well, except for pronography art :)

Database Tracing In 64 Easy Steps


There's only 55 or 60 steps, some of these are [ahem] editorial comment:
  1. Start Sybase Central.

  2. Connect to your database. Don't forget to do that. If you forget, your whole experience will be an empty one.

  3. See the "Mode" item appear in the menu bar. Q: Why wasn't it there before, disabled but visible? A: Bad GUI design.

  4. Pay NO ATTENTION to the Mode item, it just leads to the Application Profiling Wizard which in turn leads to unhappiness.

  5. Instead, right-click on the grey "oil drum" icon that represents your database in the left pane, and click on "Tracing..."

  6. See the "Database Tracing Wizard" window appear.

  7. ...or maybe not. Everything looks different the second time you do this. Q: Why is this stuff so hard to explain? A: Bad GUI design.

  8. Let's assume this is your first time, life's too short to describe every branch of a tree that has a thousand forks.

  9. Click on Next.

  10. See the "Tracing Detail Level" window appear.

  11. Check "High detail".

  12. Click on Next.

  13. See the "Edit Tracing Levels" window appear.

  14. Uncheck everything... really, uncheck all 7 items, one by one, click click click, they're useless.

  15. Click on New.

  16. See the "Add Tracing Level" dialog box appear.

  17. Choose these values:
    Scope: database
    Tracing type: plans_with_statistics
    Condition: none

  18. Take a moment to wonder why, if those are the default values for a "New" entry, why wasn't that entry already there? A: Bad GUI design.

  19. At this point, if you listen carefully, you may hear a voice say "Don't do that! It's too expensive!"

  20. Disregard the voice, click on Add.

  21. Click on Next.

  22. See the "Create External Database" window appear.

  23. Check "Do not create a new database".

  24. Click on Next.

  25. See the "Start Tracing" window appear.

  26. Check "Save tracing in this database".

  27. Check "No limit".

  28. Click on Finish.

  29. Wait a bit... it's either going to work... or it's not (see next section).

  30. If it does work...

  31. See the Sybase Central display appear as if nothing was happening... but it is, behind the scenes.

  32. To confirm that, look for this message in your database's console log...
    Diagnostic tracing is being sent to 'links=tcpip{host=127.0.0.1};ENG=sss;DBN=ddd;Encryption=SIMPLE'

  33. Switch over to ISQL, or your application, whatever, and run your test(s).

  34. When you're done running your test(s), switch back to Sybase Central.

  35. Right-click on the database icon in the left pane, and click on Tracing - Stop tracing with save.

  36. See the "Stop Tracing With Save" progress window appear and disappear... cool horizontal barber pole!

  37. NOW, go back and click on Mode - Application Profiling on the menu bar.

  38. ...that's "Mode" and then "Application Profiling", not "Application Profiling". Q: Why does a sub-menu item have the same name as a menu item? A: Bad GUI design.

  39. See the "Application Profiling Wizard" window appear.

  40. Click on Cancel.

  41. See the pretty blue "Application Profiling Details" pane appear at the bottom of the Sybase Central window.

  42. Click on the line of text "Open Analysis File or Connect to a Tracing Database". Yes, it's a link... you didn't know that, did you? A: Bad GUI design.

  43. See the "Open Analysis Or Connect To Tracing Database" dialog box appear.

  44. Check "In a tracing database"... even though you don't think you have a tracing database, you do... it's YOUR database.

  45. Click on Open.

  46. See the "Connect to a Tracing Database" dialog box open.

  47. Fill in these fields to connect to YOUR database...
    Identification tab - User ID: dba
    Identification tab - Password: xxx
    Database tab - Server name: sss
    Database tab - Database name: ddd

  48. Click on OK.

  49. See the "Tracing Database" display appear in the "Application Profiling Details" pane.

  50. Don't touch the buttons! Look down, wayyyy down, see the line of upside-down tabs? You didn't notice them at all, did you? A: Bad GUI design.

  51. Click on the "Database Tracing Data" tab.

  52. See a second line of upside-down tabs appear, with the "Summary" tab showing.

  53. Find the query you're interested in... not the BEGIN block line, but SELECT you coded in the FOR statement.

  54. On that query line, right-click "Show the Detailed SQL Statements for the Selected Summary SQL Statement"... yes, we have no verbosity.

  55. See the display switch to the "Details" tab.

  56. Find the query you're interested in... again...

  57. Take a moment to remember the "LogExpensiveQueries" feature in 9.0.2, and how you thought that was complicated.

  58. Right-click "View More SQL Statement Details for the Selected Statement".

  59. See the "SQL Statement Details" dialog box appear.

  60. See the line of upside-down tabs at the bottom of the dialog box. You STILL didn't notice them appear? Yeah, neither did I. We're just dumb, I guess.

  61. Click on the "Query Information" tab.

  62. See the plan! Woohoo!

  63. It's just like the ISQL Plan Viewer except crappier.

  64. Why "crappier"? Try saving the plan to a file, you'll see. Same thing in 12, thanks for asking.
But... you do get to see the query plan! So that's good news.

ATTACH... TRACING... could... not... connect...


Here is Database Tracing's most popular common error message:
An error has occurred - tracing was not attached to the database.
ATTACH TRACING could not connect to the tracing database
[Sybase][ODBC Driver][SQL Anywhere]ATTACH TRACING could not connect to the tracing database
SQLCODE: -1097
SQLSTATE: HY000
SQL Statement: ATTACH TRACING TO LOCAL DATABASE
You can get that error...
  • if you specify the dbsrv11 -x none command line option (TCPIP is required even for a local database), or

  • if you specify the dbsrv11 -sb 0 command line option, or

  • if you use the SQL Anywhere 12.0.0.2589 engine on a database created with 11.0.1.2276.
The latter combination (V12 Database Tracing on a V11 database) comes with a bit more excitement later on: the engine crashes on shutdown.

In every case, the "ATTACH TRACING could not connect" message gives no clue as to the real problem, and that's a real problem in itself.

Saturday, October 30, 2010

Turning Dark Clouds into Silver Linings - the slides

If you couldn't attend the conference to hear Glenn Paulley speak about data management in the cloud, you can read what he had to say here.

Of particular interest to me was this point from slide 6:

Self-management is largely all about performance
  • A significant exception: error handling
If you don't think error handling is a big deal, have a look at this this conversation about a bug a feature a bug an interesting idiosyncracy in SQL Anywhere.

Friday, October 29, 2010

The Seven Deadly Habits of an Oracle DBA

Seriously, it doesn't say "Oracle" in the title of this article, and the points it makes apply to a lot of non-Oracle shops including some using SQL Anywhere:

The Seven Deadly Habits of a DBA
But... the writer IS talking about Oracle, and Habit #5 does apply to every single large Oracle (and IBM) shop I've ever dealt with.


Habit #5. THE BLAME GAME: "Don't look at me, it's the developer's fault that SQL is in production"

Some DBAs have a real "us versus them" mentality when it comes to developers in their organization. They see themselves not as facilitators helping the developers develop quality code from a database standpoint, but rather as guardians who prevent poor-quality code from making it into production. This might seem like semantics, but a confrontational relationship between developers and DBAs results in a lack of developer initiative and significant slowdowns in release cycles.

Cures:
  • Select DBAs who understand it's their responsibility to work as an integrated team with the developers they support.

  • Cultivate a team attitude by structuring continuous DBA involvement in every project rather than at review milestones.

  • Consider assigning an individual DBA in a developer support role. If it's clearly in the job description, there's more motivation to do it well.


The "Blame Game" title is lame, the important point is the us-versus-them mentality that destroys creativity and productivity.

Wednesday, October 27, 2010

Getting a BIGINT from DATEDIFF

Did you know that DATEDIFF returns a signed INTEGER value? Not BIGINT?


SELECT EXPRTYPE ( 'SELECT DATEDIFF ( DAY, CURRENT TIMESTAMP, CURRENT TIMESTAMP + 1 )', 1 ) AS "Data Type";

Data Type
'int'

Who cares, you ask?


Well, did you know that DATEDIFF ( MILLISECOND, ... ) craps out at 25 days?

More specifically, at some point between 24 and 25 for the number of days returned by DATEDIFF ( DAY, ... ), the same call using DATEDIFF ( MILLISECOND, ... ) will blow past the limit for INTEGER.

BEGIN
DECLARE @sqlcode INTEGER;
DECLARE @sqlstate VARCHAR ( 5 );
DECLARE @errormsg VARCHAR ( 32767 );

DECLARE @ok BIGINT;
DECLARE @splat BIGINT;

SELECT DATEDIFF ( MILLISECOND,
CURRENT TIMESTAMP,
DATEADD ( DAY, 24, CURRENT TIMESTAMP ) )
INTO @ok;

BEGIN

SELECT DATEDIFF ( MILLISECOND,
CURRENT TIMESTAMP,
DATEADD ( DAY, 25, CURRENT TIMESTAMP ) )
INTO @splat;

EXCEPTION WHEN OTHERS THEN
SELECT SQLCODE, SQLSTATE, ERRORMSG()
INTO @sqlcode, @sqlstate, @errormsg;
MESSAGE STRING (
'EXCEPTION raised by "SELECT INTO @splat" at ',
CURRENT TIMESTAMP,
': SQLCODE = ', @sqlcode,
', SQLSTATE = ', @sqlstate,
', ERRORMSG() = ', @errormsg )
TO CLIENT;

END;

SELECT @ok, @splat;

END;

@ok,@splat
2073600000,(NULL)

EXCEPTION raised by "SELECT INTO @splat" at 2010-10-16 08:52:49.610: SQLCODE = -158, SQLSTATE = 22003, ERRORMSG() = Value datediff(millisecond,2010-10-16 08:52:49.610,2010-11-10 08:52:49.610) out of range for destination
You can probably figure out the exact "splat!" point between 24 and 25 days using DATEADD ( HOUR, ... ) or MINUTE or even SECOND. Note, however, that DATEDIFF ( SECOND, ... ) and MINUTE have their own splat! points, and the effect of multiple splat! points on code verbosity will soon become apparent.

Who cares? I do!


Or at least, the Foxhound Database Monitor cares... Foxhound lives and dies on the calculation of elapsed times between two arbitrary timestamps. Tiny values need to be reasonably precise, so the calculations are done in milliseconds. Huge intervals (days, weeks, years) must to be accomodated so BIGINT is used. And to reduce code complexity BIGINT milliseconds are used throughout (there's a bunch of code devoted to formatting intervals for display, and sticking to milliseconds for input to that code makes it easier).
Sounds like a job for FLOAT? Hah! ...don't talk to me about floating point numbers, they're icky sloppy things, not to be touched or handled without gloves.

Yes, I am a Data Type Bigot and proud of it. In olden days my motto was, "If it ain't greater than zero and less than 32767 I'm not interested!"

Now it's "Give me fixed point or give me death!"

Besides, DATEDIFF returns an INTEGER, and it *still* craps out at 25 days if you CAST it as FLOAT.
One workaround is to accept FLOAT-like behavior in a BIGINT value (large values are not perfectly precise), and turn failing DATEDIFF ( MILLISECOND, ... ) calls into ones that work: DATEDIFF ( SECOND, ... ) * 1000, DATEDIFF ( MINUTE, ... ) * 60 * 1000 and so on.

Here's a warts-and-all excerpt from Foxhound; the columns to look at are started_at, completed_at and run_msec:

CREATE TABLE rroad_purge_run (
run_number BIGINT NOT NULL DEFAULT AUTOINCREMENT PRIMARY KEY, -- do not INSERT or UPDATE this column
progress VARCHAR ( 100 ) NOT NULL DEFAULT 'Starting',
started_at TIMESTAMP NOT NULL DEFAULT CURRENT TIMESTAMP, -- do not INSERT or UPDATE this column
is_complete VARCHAR ( 1 ) NOT NULL DEFAULT 'N' CHECK ( @complete IN ( 'Y', 'N' ) ),
completed_at TIMESTAMP NOT NULL DEFAULT TIMESTAMP, -- do not INSERT or UPDATE this column

must_trigger_next_purge VARCHAR ( 1 ) NOT NULL DEFAULT 'N' CHECK ( must_trigger_next_purge IN ( 'Y', 'N' ) ),
sample_purge_interval VARCHAR ( 100 ) NOT NULL DEFAULT '',
uninteresting_connections_purge_interval VARCHAR ( 100 ) NOT NULL DEFAULT '',
purge_speed VARCHAR ( 100 ) NOT NULL DEFAULT '',
exception_delete_count BIGINT NOT NULL DEFAULT 0,
orphan_sample_set_delete_count BIGINT NOT NULL DEFAULT 0,
old_sample_set_delete_count BIGINT NOT NULL DEFAULT 0,
uninteresting_connections_delete_count BIGINT NOT NULL DEFAULT 0,
exception_delete_msec INTEGER NOT NULL DEFAULT 0,
orphan_sample_set_delete_msec INTEGER NOT NULL DEFAULT 0,
old_sample_set_delete_msec INTEGER NOT NULL DEFAULT 0,
uninteresting_connections_delete_msec INTEGER NOT NULL DEFAULT 0,

run_msec BIGINT NOT NULL COMPUTE (
CASE
WHEN ABS ( DATEDIFF ( YEAR, started_at, completed_at ) ) >= 4083
THEN CAST ( DATEDIFF ( HOUR, started_at, completed_at ) AS BIGINT ) * 60 * 60 * 1000

WHEN ABS ( DATEDIFF ( YEAR, started_at, completed_at ) ) >= 68
THEN CAST ( DATEDIFF ( MINUTE, started_at, completed_at ) AS BIGINT ) * 60 * 1000

WHEN ABS ( DATEDIFF ( DAY, started_at, completed_at ) ) >= 24
THEN CAST ( DATEDIFF ( SECOND, started_at, completed_at ) AS BIGINT ) * 1000

ELSE DATEDIFF ( MILLISECOND, started_at, completed_at )
END ) );
The table rroad_purge_run is used for monitoring Foxhound itself, in particular the internal database purge process.

The started_at column is initialized by DEFAULT CURRENT TIMESTAMP when the row is inserted, and completed_at is updated by the DEFAULT TIMESTAMP clause every time the row is updated. The completed_at column doesn't contain a real "completed at" value until the purge process is finished... unless the process crashes along the way, in which case it's pretty close.

The run_msec COMPUTE clause shows how various DATEDIFF splat! points are avoided by making some conservative tests: If the difference is 4083 years or more use DATEDIFF ( HOUR, ... ), else if the difference is 68 years or more use MINUTE, else so on.

Here is a simulation showing how the COMPUTE works for small intervals. After the first UPDATE run_msec is 593 and after the second run_msec = 1140:

INSERT rroad_purge_run ( run_number ) VALUES ( DEFAULT ); -- work begins

WAITFOR DELAY '00:00:00.5'; -- some work is done

UPDATE rroad_purge_run
SET exception_delete_count = 123 -- a column is changed
WHERE run_number = 1;

SELECT started_at, completed_at, run_msec
FROM rroad_purge_run;

started_at,completed_at,run_msec
'2010-10-16 08:11:37.910','2010-10-16 08:11:38.503',593

WAITFOR DELAY '00:00:00.5'; -- more work is done

UPDATE rroad_purge_run
SET orphan_sample_set_delete_count = 567 -- another column is changed
WHERE run_number = 1;

SELECT started_at, completed_at, run_msec
FROM rroad_purge_run;

started_at,completed_at,run_msec
'2010-10-16 08:11:37.910','2010-10-16 08:11:39.050',1140
Here's another simulation showing how the COMPUTE works for 23 versus 25 days; there's no EXCEPTION, but there is also a slight loss of precision (the 11 milliseconds is lost: 1987200011 versus 2160000000):

UPDATE rroad_purge_run
SET completed_at = DATEADD ( DAY, 23, DATEADD ( MILLISECOND, 11, started_at ) )
WHERE run_number = 1;

SELECT started_at, completed_at, run_msec
FROM rroad_purge_run;

started_at,completed_at,run_msec
'2010-10-16 08:11:37.910','2010-11-08 08:11:37.921',1987200011

UPDATE rroad_purge_run
SET completed_at = DATEADD ( DAY, 25, DATEADD ( MILLISECOND, 11, started_at ) )
WHERE run_number = 1;

SELECT started_at, completed_at, run_msec
FROM rroad_purge_run;

started_at,completed_at,run_msec
'2010-10-16 08:11:37.910','2010-11-10 08:11:37.921',2160000000

Monday, October 25, 2010

Sybase goes crazy hiring

Well, maybe not all of Sybase, but surely one part is hiring like the recession's over. Do this Google search, see how many hits you get:

jobs "Sybase Federal, an SAP GSS Company"
A little bird told me that the successful 2010 US Census project has been a real door-opener for SQL Anywhere and MobiLink inside the US federal government.

Saturday, October 23, 2010

Cisco appreciates SQL Anywhere

For those of you who don't read SQLA, here's an excerpt from a recent "Sybase Partner News" email (the emphasis is mine):

Sybase Wins Cisco's Annual Supplier Appreciation Award for Software Excellence

September 30, 2010 - presented during its annual Supplier Appreciation Conference, this is the first year Cisco recognized software suppliers in addition to several categories for hardware suppliers. Cisco currently embeds SQL Anywhere in nearly 20 products, and cited Sybase iAnywhere's efforts to ensure Cisco's success with the technology. During the presentation, Cisco praised Sybase iAnywhere's unique approach, and the technical and relationship support provided by the Sybase team.

Friday, October 22, 2010

Well, don't leave us hanging... is this a bug or not?

Back on October 9 I posted "What's going on here?" about the suspicious behavior of a simple SELECT with and without a WHERE clause.

The first line said "Can something this simple really be so wrong?" and the last line said "This is a bug in SQL Anywhere 11.0.1.2276, right?"

Anonymous said...
Well, don't leave us hanging... is this a bug or not?

October 14, 2010 10:53 AM
[redacted] said...
I say it's a bug. The documentation pretty clearly states that the ORDER BY clause will be respected (and is in fact more or less required) for TOP and START AT.

Is there an index on the "data" column?

October 14, 2010 8:55 PM
Well, [redacted] is not alone. I thought it was a bug, too, until someone pointed out to me...

That's how TOP works!

TOP is evaluated after the WHERE clause has done it's thing. Long after. I should know that, I used up ten pages in my book talking about the "Logical Execution of a SELECT". That section listed 15 separate steps, with the WHERE clause coming in at Step Number 3 and the TOP clause way down at Step Number 12.

Oh, and ORDER BY is back at Step Number 9.

In my defense, the actual SELECT I was working with was way more complex than the one described in "What's going on here?"... but I still wasted several hours over two days.

Still don't get it?

Don't feel bad, you haven't spent two days thinking about it like I did.

And not everyone can be Mark C. or V Barth or Phil, who all got it right, right away...
Mark C. said...
Breck: If there are five rows in the "top 10" of original query where data != 'B' then these five rows would not be included in the second query's result set and this would cause the output of the second query to be different.

October 9, 2010 11:21 AM
V Barth said...
Oh, a riddle?

I suggest there are 5 rows in ther pkey range 1-9 WHERE data = 'B' IS NOT TRUE. Therefore the rows 10-14 are still part of the 2nd select but get skipped by the START AT clause as they are now among the first 9 rows.

October 10, 2010 11:27 AM
Phil said...
What's the data for pkey 1 through 9? I'm not an expert, but if there are 5 rows with data != 'B', then I would expect this result. I would read this query as "give me rows 10 through 15 that meet these conditions" not "give me the rows that meet these conditions from rows 10 through 15."

October 11, 2010 11:45 AM
If you got fooled into thinking it was a bug in SQL Anywhere, it might be because rows 1 through 9 were left out of "What's going on here?". I did that on purpose so you could be misled just like I was.

Here's the full demo...

CREATE TABLE t (
pkey INTEGER NOT NULL DEFAULT AUTOINCREMENT PRIMARY KEY,
data VARCHAR ( 10 ) NOT NULL );

INSERT t VALUES ( 1, 'A' );
INSERT t VALUES ( 2, 'A' );
INSERT t VALUES ( 3, 'A' );
INSERT t VALUES ( 4, 'A' );
INSERT t VALUES ( 5, 'A' );
INSERT t VALUES ( 6, 'B' );
INSERT t VALUES ( 7, 'B' );
INSERT t VALUES ( 8, 'B' );
INSERT t VALUES ( 9, 'B' );
INSERT t VALUES ( 10, 'B' );
INSERT t VALUES ( 11, 'B' );
INSERT t VALUES ( 12, 'B' );
INSERT t VALUES ( 13, 'B' );
INSERT t VALUES ( 14, 'B' );
INSERT t VALUES ( 15, 'B' );
INSERT t VALUES ( 16, 'B' );
INSERT t VALUES ( 17, 'B' );
INSERT t VALUES ( 18, 'B' );
INSERT t VALUES ( 19, 'B' );
INSERT t VALUES ( 20, 'B' );
COMMIT;

SELECT TOP 5 START AT 10 *
FROM t
ORDER BY pkey;

pkey,data
10,'B'
11,'B'
12,'B'
13,'B'
14,'B'

SELECT TOP 5 START AT 10 *
FROM t
WHERE data = 'B'
ORDER BY pkey;

pkey,data
15,'B'
16,'B'
17,'B'
18,'B'
19,'B'

My new excuse? There were 22 million rows in the actual table. That's my story, and I'm sticking to it.

Wednesday, October 20, 2010

It's good to be INSENSITIVE

Here's something you may have heard from time to time:

Don't use cursors to make changes. Use set-oriented SQL statements instead.
But hey, sometimes you HAVE to write a COBOL-style program, one that uses an old-fashioned input-process-repeat loop to manipulate a result set one record, er, row at a time.

Sure, you can spend a couple of days figuring out how WINDOW works with UPDATE, or whether MERGE will work for your convoluted requirements... or you can spend a couple of hours writing a fetch loop.

If you do use a cursor, here's another slogan (this is the short form, the long form comes later):
Always make your cursors INSENSITIVE.
An insensitive cursor is a safe cursor, all other forms are spooky scary. If you like spooky scary, then fine, go ahead. But be prepared for never knowing if your code's going to work in all scenarios... well, you can never know that anyway, but with other kinds of cursors you can be pretty sure you WILL have problems, eventually.

Why is it good to be insensitive? Because an insensitive cursor is a stable cursor, it doesn't matter what goes on around it (in other connections, even the same connection), the result set is fixed when the loop starts. With other types of cursors the rules are fantastically complicated... and the rules change from release to release.

OK, you've got questions, "Always make your cursors INSENSITIVE" is really simplistic. Maybe the long form will help:
If you are going to INSERT, UPDATE or DELETE any of the tables involved in a cursor definition, either directly (your code inside the fetch loop) or indirectly (say, when your connection fires a trigger that makes such a change, or when some other connection, even an EVENT that your code fires, makes such a change), then
  • always specify both INSENSITIVE and FOR READ ONLY, and

  • never use WHERE CURRENT OF, always use UPDATE and DELETE statements with ordinary WHERE clauses.
If you end up having performance problems, then consider changing INSENSITIVE to something else. Most of the time (80%? 90%? 99%?) you won't have to, and life will be that much safer and easier.
Here's a SQL fetch loop template using the wonderful FOR loop syntax:

FOR [loop name] AS [cursor name] INSENSITIVE CURSOR FOR
SELECT t.primary_key_column_1_of_2 AS @primary_key_column_1_of_2,
t.primary_key_column_2_of_2 AS @primary_key_column_2_of_2,
t.[some other column] AS @[some other column],
t.[some other column] AS @[some other column]
FROM t
WHERE [some predicates]
ORDER BY [some columns]
FOR READ ONLY
DO
...
[references to the @variables implicitly declared in the SELECT]
...
INSERT t ( [some column names] ) VALUES ( [some values] )
...
UPDATE t
SET t.[some other column] = [some value],
t.[some other column] = [some value]
WHERE t.primary_key_column_1_of_2 = @primary_key_column_1_of_2
AND t.primary_key_column_2_of_2 = @primary_key_column_2_of_2;
...
DELETE t
WHERE t.primary_key_column_1_of_2 = @primary_key_column_1_of_2
AND t.primary_key_column_2_of_2 = @primary_key_column_2_of_2;
...
END FOR;


Question: Isn't FOR READ ONLY redundant when you code INSENSITIVE? You can't use WHERE CURRENT OF with an INSENSITIVE cursor, can you?

Answer: Once upon a time (Version 7) INSENSITIVE cursors could be updatable. Besides, the rules for cursors change all the time, who knows what INSENSITIVE with FOR UPDATE might mean in the future... maybe at runtime it will morph into a value-sensitive cursor without telling you.

If you see the following statement in the Help for Version 8 or later, just ignore it, it's wrong (and it's being fixed):
INSENSITIVE ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.
Let's beat the point to death, er, drive the point home... if you printed out all the Help files, here's how you could fix them:
Version 5 is OK: A cursor declared INSENSITIVE ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 6 is OK: INSENSITIVE cursors ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 7 is OK: INSENSITIVE cursors ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 8: INSENSITIVE ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 9: INSENSITIVE ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 10: INSENSITIVE ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 11: INSENSITIVE clause ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.

Version 12: INSENSITIVE clause ... It does see the effect of PUT, UPDATE WHERE CURRENT, DELETE WHERE CURRENT operations on the same cursor.


More stuff...
Insensitive cursors
FOR statement
DECLARE CURSOR statement
Does anyone else WANT TO KNOW how cursors really work?

Monday, October 18, 2010

Turning Dark Clouds into Silver Linings

Here is the abstract of the keynote speech Glenn Paulley will be giving at the CIKM 2010 - 19th ACM International Conference on Information and Knowledge Management in Toronto, October 26 to 30, 2010:



Turning Dark Clouds into Silver Linings

Data management services are ubiquitous in the industry. With some important exceptions, relational database systems are the platform upon which many applications depend, including mainframe servers, web browsers, and handheld devices. The vast majority of these installations run unattended. Consequently, self-management, self-tuning, and self-healing features are of great importance to these systems. Cloud computing architectures, due to their inherent dynamics, add another level of flexibility - and complexity - to the problems of database self-management.

However, application developers continue to experience unpredictable performance and reliability issues with the application's software stack. Over the past few years, these issues have led to a variety of proposals to address the problem, including weak consistency models and the abandonment of SQL as a data management sub-language.

In this talk I'll present an overview of the data management problems in relational database systems that are exacerbated by cloud computing architectures, discuss the state-of-the-art in self-management technology, and conclude with some ideas for future research to address these problems.

Speaker Information



Glenn Paulley is a Director with Sybase iAnywhere Engineering, where he manages the research and development team responsible for query processing in SQL Anywhere, Sybase's self-managing relational database server. He joined Sybase iAnywhere in 1995. During his 20-year industrial career Glenn has held previous positions at Amdahl Corporation and at a large Canadian insurance company. He holds a Ph.D in Computer Science from the University of Waterloo. His research interests include software usability, query optimization, information systems architecture, design of Management Information Systems, topics in systems analysis, interfaces to database systems, database query languages, user models, multidatabase systems, and indexing techniques.

Thursday, October 14, 2010

Using HTTPS with your SQL Anywhere-based web server

This article is based on this SQLA question-and-answer, How do I set up a TYPE RAW web service to use HTTPS? and on this not-yet-published Foxhound FAQ: How do I specify the HTTPS transport-layer security for Foxhound?



If you have built TYPE RAW web services in SQL Anywhere, or (I'm guessing) TYPE HTML etcetera, you can support HTTPS without making any changes to your SQL code.

You can do this by modifying the SQL Anywhere startup command line to specify RSA encryption and the HTTPS protocol as follows:
  • Obtain an identity certificate and the associated private key for your server.

  • Store the identity certificate file in a known location.

  • Change the -xs option to specify https on the dbsrv*.exe command line used to start your SQL Anywhere server:
    Specify the identity certificate file and private key in the -xs https identity= and identity_password= parameters.

    Note that the default port for HTTPS is 443.
Here is an example of a dbsrv11.exe command line modified to allow only HTTPS access to Foxhound data using the sample certificate "%SQLANY11%\Bin32\rsaserver.id" that comes with SQL Anywhere 11:

(Note: Only the -xs line had to be changed, all the other stuff was there before.)

"%SQLANY11%\Bin32\dbspawn.exe"^
-f^
"%SQLANY11%\Bin32\dbsrv11.exe"^
-c 50p^
-ch 75p^
-cr-^
-gk all^
-gn 120^
-n foxhound1^
-o foxhound1_debug.txt^
-oe foxhound1_debug_startup.txt^
-on 10M^
-qn^
-sb 0^
-x none^
-xd^
-xs https(identity="%SQLANY11%\Bin32\rsaserver.id";identity_password=test;port=443;maxsize=0;to=600;kto=600)^
foxhound1.db^
-n f

If you want to allow both HTTP and HTTPS access, specify both as follows:

-xs http(port=80;maxsize=0;to=600;kto=600),https(identity="%SQLANY11%\Bin32\rsaserver.id";identity_password=test;port=443;maxsize=0;to=600;kto=600)^

To read more about -xs, see Starting the database server with transport-layer security and the -xs dbeng12/dbsrv12 server option in the Help.

How come I don't have to code SECURE ON?


You can add the SECURE ON clause to every single web service if you want...

CREATE SERVICE service_name TYPE 'RAW'
AUTHORIZATION OFF USER user_name SECURE ON
AS CALL procedure_name (
:parameter1,
:parameter2 );

...but you don't have to. If you have complete administrative control over the command line used to start SQL Anywhere, then omitting the SECURE ON clause gives you more flexibility in deciding whether or not, and when, to support HTTP and/or HTTPS.

That's the case with the SQL Anywhere database that is Foxhound: it's up to each customer to decide if they want HTTP (the default) and/or HTTPS, and if they want to lock it down to use only HTTPS they must have control over the command line.

To read more about SECURE ON, see the Help on the CREATE SERVICE statement and Mark Culp's answer to this question in SQLA.

Saturday, October 9, 2010

What's going on here?

Can something this simple really be so wrong? Here's a simple query in SQL Anywhere 11.0.1.2276 that returns 5 rows, starting at row number 10, from a table t where pkey is the PRIMARY KEY column t, and that column is DEFAULT AUTOINCREMENT with values 1, 2, 3...:


SELECT TOP 5 START AT 10 *
FROM t
ORDER BY pkey;

pkey,data
10,'B'
11,'B'
12,'B'
13,'B'
14,'B'

So far so good... now supposing we add WHERE data = 'B' to the query; shouldn't the result set be the same?

But it's not! Look here:

SELECT TOP 5 START AT 10 *
FROM t
WHERE data = 'B'
ORDER BY pkey;

pkey,data
15,'B'
16,'B'
17,'B'
18,'B'
19,'B'

What's going on here? Clearly rows 10 through 14 have data = 'B', why aren't those rows showing up in the second query?

This is a bug in SQL Anywhere 11.0.1.2276, right?

For the answer see Well, don't leave us hanging... is this a bug or not?

Wednesday, August 4, 2010

Foxhound is now Generally Available


Foxhound is now GA: www.risingroad.com/foxhound



What is Foxhound? - Foxhound is a database monitor and a schema troubleshooter for SQL Anywhere.

What's new in Foxhound GA 1.3738?

Download Foxhound GA - requires a registration key to activate

Get a Foxhound Registration Key

Foxhound FAQ

Saturday, July 31, 2010

A SQL Anywhere Web Service for Displaying Images

Most SQL Anywhere web services are devoted to returning HTML, XML and other text to the client, but they work just fine for binary data too... like images.

Code first, explanation later...


Here's a web service that returns an image to the browser; all it has to do is set the "Content-Type" and return the image as a single-row single-column result set:

CREATE SERVICE rroad_display_image TYPE 'RAW'
AUTHORIZATION OFF USER DBA_image
AS CALL rroad_display_image ( :f );

CREATE PROCEDURE rroad_display_image (
IN @p_file_name VARCHAR ( 100 ) )
BEGIN

CALL dbo.sa_set_http_header( 'Content-Type', 'image/gif' );

SELECT file_image
FROM rroad_image
WHERE file_name = @p_file_name;

END; -- rroad_display_image

In this case, the images are stored in a table, inside the same database where the code for the web service runs:

CREATE TABLE rroad_image (
file_name VARCHAR ( 100 ) NOT NULL,
file_image LONG BINARY NOT NULL,
PRIMARY KEY ( file_name ) );

INSERT rroad_image VALUES ( 'help.gif', dbo.xp_read_file ( 'images\\help.gif' ) );
INSERT rroad_image VALUES ( 'favicon_m.ico', dbo.xp_read_file ( 'images\\favicon_m.ico' ) );

Here's a snippet of code from a "calling" web service called rroad_history_menu that needs to display an image named "help.gif". The <IMG SRC="rroad_display_image?f=help.gif"... tag passes the file name help.gif to the rroad_display_image web service via the parameter named f. When the web page created by rroad_history_menu hits the browser, that IMG tag is evaluated and the rroad_display_image web service is called to return the image:

CREATE SERVICE rroad_history_menu TYPE 'RAW'
AUTHORIZATION OFF USER DBA_history_menu
AS CALL rroad_history_menu ( :z1, -- session id1
:zi, -- sampling id
:sn ); -- sample set number

CREATE PROCEDURE rroad_history_menu (
IN @z1 LONG VARCHAR DEFAULT NULL, -- session id1
IN @zi LONG VARCHAR DEFAULT NULL, -- sampling id
IN @sn LONG VARCHAR DEFAULT NULL ) -- sample set number
RESULT ( html_output LONG VARCHAR )
BEGIN

SELECT STRING (
'<HTML>',

...

--------------------------------------------------
-- Menu: Line 1: Help icon and link

'<A HREF="rroad_help_frame?f=foxhound_history#menu" ',
'TARGET="help_frame" TITLE="Show a description of this menu area in the Help frame">',
'<IMG SRC="rroad_display_image?f=help.gif" BORDER="0" WIDTH="16" HEIGHT="16" HSPACE="0" VSPACE="0" ',
'STYLE="vertical-align: text-bottom; border-bottom: 1px solid blue"> Help</A>    ',

...

'</HTML>' );

END; -- rroad_history_menu

There are several copies of help.gif displayed by rroad_history_menu, one for each context-sensitive Help area; look for the little blue "?" marks:



Here's another snippet of code that needs to return a "favicon" to the browser. When the web page created by the SELECT statement hits the browser, the <LINK ... HREF="rroad_display_image?f=favicon_m.ico" tag tells the browser to turn around and call rroad_display_image to get favicon_m.ico:

CALL dbo.sa_set_http_header( 'Content-Type', 'text/html' );

SELECT STRING (
'<HTML>',
'<HEAD>',
...
'<LINK REL="SHORTCUT ICON" HREF="rroad_display_image?f=favicon_m.ico" />',
'</HEAD>',
...
'</HTML>' );

Here's what favicon_m.ico looks like on the Firefox tab bar (look for the "M"):



The observant reader will notice that it doesn't seem to matter that 'Content-Type' is set to 'image/gif' in the first snippet of code... it works fine for *.ico files, and *.jpg too. Web browsers are wonderfully robust, they really don't mind if your HTML is a bit shaky... even if you commit heresies like forgetting to code the <BODY> tag. It's a good thing HTML came along before XML and all those Politically Correct Programmers who insist <P> without </P> is a crime against humanity, otherwise nobody would get any work done :)

Monday, July 19, 2010

The LAST Foxhound Beta build


The LAST beta build of Foxhound is now available...



What is Foxhound? - Foxhound is a database monitor and a schema troubleshooter for SQL Anywhere.

What's new in Foxhound Beta build 3736?

Download Foxhound Beta build 3736 - expires August 15 2010

Foxhound FAQ



What's next? GA, coming soon... before Techwave (yes, the Beta expiry date will overlap with GA availability, to give folks some flexibility in their schedules).

Saturday, July 3, 2010

10 Cool New Features In SQL Anywhere 12

The original title was "Top 10 Cool New Features In SQL Anywhere 12" but the "Top" got dropped betwixt submission and publication.

Here's where you can read it: http://www.sybase.com/detail?id=1080609

Thursday, July 1, 2010

Webcast: Getting to Know SQL Anywhere 12

Register: http://marketing.ianywhere.com/forms/GetToKnow12

Date: Wednesday, July 14, 2010

Times: 7am PDT / 10am EDT / 3pm GMT / 4pm CET

- or -
11am PDT / 2pm EDT / 7pm GMT / 8pm CET

Presenter: Eric Farrar, SQL Anywhere Product Manager
SQL Anywhere 12, the newest release of SQL Anywhere, builds on the power of its database and advanced synchronization technology by focusing on exciting new enhancements in the areas of out-of-box performance, scalability and monitoring, advanced data synchronization, and developer productivity tools. Join us for an exciting first look at the new features and find out how SQL Anywhere 12 can impact your application with improved performance and functionality like never before.

This webcast takes a look at the exciting new SQL Anywhere 12 data management and data synchronization features. Through discussion and demos, you will learn about data management highlights in SQL Anywhere 12 including new language extensions, performance and scalability enhancements, spatial support, and the new administration and monitoring tool features. There will also be an overview of the improvements made in the areas of data synchronization including central administration of remote databases, diagnostic tools, iPhone support, and UltraLite enhancements. This is your opportunity to learn first-hand about SQL Anywhere 12 and all it has to offer!

Monday, June 28, 2010

New Foxhound Beta build 3707 available (expires July 31)


Download Foxhound Beta build 3707 - new build posted June 28, expires July 31 2010

What's new in Foxhound Beta build 3707?

What is Foxhound? - Foxhound is a database monitor and a schema troubleshooter for SQL Anywhere.

Foxhound FAQ

Monday, March 29, 2010

Foxhound Beta Now Available

Foxhound is a database monitor and a schema troubleshooter for SQL Anywhere.

"Foxhound will be a valuable tool for developers, DBAs as well as data center operations personnel." - Chris Kleisath, Senior Director of Engineering for SQL Anywhere, in his review Foxhound – A Useful Tool for SQL Anywhere Users
Here's the FAQ, including What is Foxhound?

Here's where to get the download.




Thursday, March 18, 2010

Top Fifty Cool New Features In SQL Anywhere 12?

Back in 2008 I wrote "Top 10 Cool New Features in SQL Anywhere 11" and before that (in 2006) "Top 10 Cool New Features in SQL Anywhere 10".

It's time again now, and it's the same old problem: Too Much Cool New Stuff.

How much is too much? Fifty. That's the number of new features and changes in SQL Anywhere 12 that made the first Cool cut.

Fifty features is about one-in-ten as far as I can tell. So once again there there's lots of Cool.

And "all things spatial" only counts as one pick in my list. So you get the idea... it's hard to choose... easier to crank out "Top Fifty Cool New Features In SQL Anywhere 12".

But there's a deadline. Maybe, after I run out of time working with "spatial" it'll be "Top One Cool New Feature In SQL Anywhere 12".

Monday, March 8, 2010

Visit SQLA! ...the new SQL Anywhere online community

This was posted on all the SQL Anywhere newsgroups this morning...


This is an open invitation to all SQL Anywhere newsgroup users to visit the new Web 2.0 site called SQLA.

SQLA is for new SQL Anywhere users, enthusiasts and experts alike. It runs on the Question and Answer software originally made famous by StackOverflow.com.

SQLA isn't the same as StackOverflow, however. SQLA is a new community, devoted to SQL Anywhere and everything that comes "in the box", and it is completely separate from StackOverflow.

To find out more, try it for yourself, and check out the Frequently Asked Questions.

In particular...

What makes SQLA different from the newsgroups?

How do I carry on a discussion?

Sunday, February 28, 2010

The Final FAQ

As noted in my previous post the new SQLA question-and-answer website devoted to SQL Anywhere is ready for prime time. It's still in beta, yes, but it's ready for more people to use it.

The first step in that direction is now complete: The SQLA FAQ has been updated to reflect everything that's been learned over the first three month's of SQLA's existence.

Here's the Table Of Contents for SQLA's "Final FAQ":

What kind of questions can I ask here?
Do I have to log in to SQLA, or create an account?
Can I ask a stupid question?
Can I post sample code?
What if my English isn't very good?
How do I pick tags?
What is a "prefix"?
Why can’t I ask "subjective questions"?
What if I have more than one question?
What can I put in an answer?
Is it OK to answer my own question?
How should I behave?
How do I carry on a nested/threaded conversation?
Is it OK for vendors to post questions?
Can I talk about the beta?
Can I ask about PowerBuilder?
How come other people can edit my stuff?
How does moderation work?
What are reputation points?
What is a bounty?
How do I get back to the list of "Recent Questions"?
How do I edit a comment?
How do I post images and other files?
Is this site just like StackOverflow, except for being dedicated to SQL Anywhere?
Is SQLA owned by Sybase?
Who pays for SQLA?
When will SQLA go live?
Where is SQLA data stored? Is there a backup?
Why is it called "SQLA" instead of "SQLAnywhere"?
What are the Terms and Conditions for posting on SQLA?
What can I do if I don't like the way SQLA is being run?
What if I get a wrong answer?

Thursday, February 25, 2010

SQLA Has Backup!

SQLA is the new community question-and-answer website devoted to SQL Anywhere that started Beta testing back on November 8, 2009.

SQLA is still in Beta, but it IS ready for more traffic now that The Really Big Obstacle has been overcome: We have backup!

(if anyone wants a copy of the XML dump of all SQLA content, just email me at breck.carter at gmail.com)

So... SQLA is ready for prime time!


Time to invite more people to participate.

But first... it's time for the administrator (that's me) to update the SQLA FAQ to reflect all the wonderful results from the past few weeks of experimentation with SQLA... the StackExchange software REALLY IS SO MUCH BETTER than the best NNTP client-server setup, the best bulletin board software, the best "threaded forum" websites.

Updating the FAQ will take a bit of time, mainly because SQLA is not StackOverflow... SQLA works by a completely different set of rules than StackOverflow.com... mostly FEWER rules, FEWER restrictions, MORE freedom to use the site effectively.

Hard to explain... that's another "to do" item for me, come up with a sales pitch.

In the meantime, if you want to know more about the people behind the StackExchange software that runs SQLA, where it came from, where it's going, this recent podcast from Joel Spolsky answers questions submitted by administrators who operate websites just like SQLA. And there's hundreds of them.

Who doesn't have an hour to listen to Joel Spolsky? Well, maybe you don't, so here are SOME of the high points (there's lots more, including stuff I did not know like the StackExchange software is a separate fork of StackOverflow, and it's StackOverflow going the venture capital route, not StackExchange):


Joel sits down with the Stack Exchange team, who are working on the hosted version of Stack Overflow at the Fog Creek offices in New York City.
  • Meet the Stack Exchange team -- David Fullerton, Aaron Maenpaa, and Emmett Nicholas.

  • For Stack Exchange sites that have a smaller community, Stack Exchanges may email users more aggressively, to invite users to answer less trafficked SE questions. Joel proposes that weekly roll-up emails might work well on smaller Stack Exchange sites.

  • Stack Exchange is a hosted service; it's currently running on 2.5 servers and soon a third.

  • Stack Exchange has an export feature, so all the data in your site can be dumped out to a file, similar to the way the monthly Stack Overflow cc-wiki data dumps work.

  • Joel blogged about Stack Overflow looking for venture capital -- that should not affect Stack Exchange. In any case, even if it did, you can use your own domain name which you take with you, and as mentioned above, you can export all your data. There should be competition, and smart competitors will support the Stack Overflow and Stack Exchange export formats.

  • Stack Exchange pricing is already at maximum, primarily to reduce demand to a level that the current SE team can support. It can only go down over time! It is definitely our goal to make it easier over time for everyone who wants a Stack Exchange site to have one. We're exploring a lot of possibilities including ad subsidized; it's also possible that larger corporate adoption of Stack Exchange may subsidize the smaller community sites as well.

  • Right now every Stack Exchange site has its own IIS website (even though they all share the same app pool), but that turns out to be not a great performance model for lots of small sites. 

  • One of the Catch-22s of a Stack Exchange site is that fundamental actions like voting up and creating tags require reputation, but nobody has any reputation on a new site. The Stack Exchange team added a "bootstrap mode" which relaxes a lot of these requirements so you can get your site up and running.

  • David notes that a smooth admin / owner setup process is essential to the Stack Exchange service model. You also can't have a ghost town -- you need some questions bootstrapped into the system before you even show it to the broader public. This is analogous to the private invitation-only betas we did for Stack Overflow, Super User, and Server Fault.

  • If you'd like to provide additional feedback to the Stack Exchange team, we encourage you to visit Meta Stack Exchange and help us dogfood our own system.

Thursday, February 18, 2010

Sybase Developer Days Worldwide Seminar Tour 2010

Save the Date...

Join Sybase's technical experts who will showcase the latest releases of our industry leading development software. All seminars are free and run from 8.30am - 2pm local time (timing may vary slightly by location) with breakfast and lunch included. Each Seminar features a keynote presentation followed by your choice of tracks:

  • Advantage Database Server 10

  • PowerBuilder 12

  • SQL Anywhere Innsbruck

  • Sybase Unwired Platform 1.5

Europe

  • Monday, April 19, 2010, Milan, Italy

  • Tuesday, April 20, 2010, Wiesbaden, Germany

  • Wednesday, April 21, 2010, Amsterdam, Netherlands

  • Thursday, April 22, 2010, London, UK

  • Friday, April 23, 2010, Madrid, Spain

  • Tuesday, April 27, 2010, Stockholm, Sweden

  • Wednesday, April 28, 2010, Paris, France

North America

  • Monday, May 3, 2010, Boston, USA

  • Tuesday, May 4, 2010, New York, USA

  • Thursday, May 6, 2010, Houston, USA

  • Tuesday, May 11, 2010, Los Angeles, USA

  • Wednesday, May 12, 2010, San Francisco, USA

Monday, February 1, 2010

Try rebooting

Caution: This is another fluff-piece just like "When did Google become perfect?"... it's not in the same league as deep-thought articles like, for example, those by Glenn Paulley and others... heck, it's not even in the same sport.

But sometimes shallow thinking is called for... like when you're faced with some bizarre computer problem that just won't go away when you wave a dead chicken over the keyboard. That's when "try rebooting" comes in to play.

I remember the first time I had reboot power over a computer... it was the mid-1980s, the computer was an IBM 3270 video controller, and the boss said "try turning it off and on" when all the dumb terminals in the office stopped working properly.

Prior to that, turning off "the computer" was a firing offense... there was a big red OFF button on the wall in the mainframe room, and if you pressed that button you had better be on fire... yourself... with no hope of personal survival.

Then came PCs, and rebooting became a regular ritual performed many times a day... folks didn't think anything of it. "Keep your config.sys and autoexec.bat small" was standard advice so rebooting would be fast. The application development life cycle was described as "edit, compile, test, reboot."

And then, fast forward to 2010, computers are much more reliable, you don't have to reboot every time you change a network setting or perform some other minor task, and once again folks are used to long periods of up-time.

Here's another piece of wisdom: "Don't forget what you already know." What you know is that rebooting is a powerful problem resolution technique, and if you don't have a clue about what's wrong then "try rebooting" should be one of the first things you consider.

Example: Norton Ghost crashes intermittently when doing a high-speed backup across TCP/IP to another computer, or via USB to an external disk drive: "Error EBAB03F1: Insufficient system resources exist to complete the requested service".

Solution: After such a crash try rebooting. Norton Ghost will now work... so far, 100% of the time. It took me months to realize "try rebooting" was the solution, and for more months "try rebooting" has proven to be the only reliable solution. Don't ask me about the CAT6 upgrade, the new router, the endless "system tuning" efforts... wasted time, wasted money.
Here's another example: If you install software using an InstallShield setup.exe, and something doesn't work right afterwards, try rebooting. This applies to SQL Anywhere. It even applies to a SQL Anywhere EBF. Something might have been "in use" when the setup ran and Windows is waiting for a reboot to finish overwriting the old thing with the new thing.

Yes, it's magic. So is waving a dead chicken over the keyboard. So is "try rebooting"... except it doesn't just make you feel better, it sometimes actually works.

Wednesday, January 27, 2010

OMIGOSH! Proxy tables are FAST!

Normally, everything about a SQL Anywhere Beta is Super Secret Stuff but Sybase has given me explicit permission to publish this article.

There are strings attached:
  • I have to tell you where to go (to get the Beta ...why, what did you think I meant? :)

  • I have to tell you that I received explicit permission from Sybase to publish this.

  • I have to tell you the Beta is Super Secret Stuff... that the Beta agreement does not normally allow articles like this.
There, all done, twice.
OK, got that? Here's the story: I've been working for oh-too-long on an article entitled "Downloading Data into a SQL Anywhere In-Memory Database from Microsoft SQL Server", and that article discusses several techniques using SQL Server 2008 and SQL Anywhere 11.0.1. Two of those techniques are BCP and LOAD TABLE (always the fastest) and proxy tables (always the slowest).

Folks who know about BCP will claim nothing on earth can unload data from a SQL Server database faster than that, and folks who know about SQL Anywhere will say the same thing about loading data via LOAD TABLE.

And lots of people will tell that proxy tables, well, suck when it comes to performance.

All of that is is certainly true for SQL Anywhere 11.0.1: the BCP and LOAD TABLE test for the article took 720 seconds for 1.9 million rows whereas INSERT ... SELECT * FROM a proxy table took 4230 seconds... think "rocket fast" versus "continental drift".

But that's all changing with SQL Anywhere Innsbruck! The INSERT ... SELECT * FROM a proxy table only took 687 seconds! Proxy tables went from last to first place in the performance tests!

Here's my guess what's happened: First, the iAnywhere engineers have made some performance improvements to proxy tables, that I've been told is true.

Second, and this is guesswork on my part, the proxy table path runs directly from one database to another, it doesn't involve writing to or reading from an external disk file like BCP and LOAD TABLE. So, that bit of extra file I/O overhead is always gonna be an anchor 'round the neck of BCP and LOAD TABLE.

FYI, here is my very first post on the SQL Anywhere Beta forum (the "over a minute" claim was wrong, the proxy table test was only 33 seconds faster than BCP and LOAD TABLE):


Subject: OMIGOSH! Proxy tables are FAST!

Here's the full text of my forthcoming article "Top 1 New Features Of
SQL Anywhere Innsbruck"... seriously... I *live* for proxy tables...

CREATE SERVER mss
CLASS 'MSSODBC'
USING 'DSN=main_BRECK-PC';

CREATE EXTERNLOGIN DBA
TO mss
REMOTE LOGIN "sa"
IDENTIFIED BY 'j68Fje9#fyu489';

CREATE EXISTING TABLE proxy_mss_source
AT 'mss.main.dbo.mss_source';

INSERT sa_target
SELECT *
FROM proxy_mss_source;

-- 11.0.1...
1925469 row(s) inserted
Execution time: 4229.875 seconds

-- Innsbruck...
1925469 row(s) inserted
Execution time: 686.859 seconds

...ok, I'm REALLY serious, that just beat the combination of MSS 2008
BCP and 11.0.1 LOAD TABLE for transferring data straight across, by
over a minute, and hey, NOTHING beats BCP and LOAD TABLE... nothing!

Woohoo!

Breck Is Tilting On His Axis

Friday, January 15, 2010

When did Google become perfect?

This problem had been bugging me for years: I couldn't figure out how to use wonderfully-modern Wordpad instead of awkwardly-ancient Notepad to edit *.bat files.

So this morning I just bit the bullet, typed my question into Google...

how do I change the default editor for batch files
Check it out, see how stupid I feel now, not at the answer, but that sometimes when I have a question
Google is not the first thing I try.
That's just dumb.

How long has this interweb been going on?

Wednesday, January 13, 2010

Ranking SQLA

The SQLA question & answer website for SQL Anywhere ranks well down in the list of StackExchange beta sites:

  • 45th in number of questions

  • 45th in number of answers

  • 53rd in number of registered users

  • 47th in number of answers per question
But... SQLA isn't anywhere near the bottom, there are 154 sites in the list.

Some thoughts:
  • Some of those 154 sites are dead... ok, lots of them are dead, but the StackExchange beta software is sure getting a good workout.

  • SQLA hasn't been actively promoted yet. That's partly because everything's still in beta but mostly because there's no end-user backup yet (where "end user" means "site administrator", which is me).

  • The fact that SQLA has essentially the same rank in all 4 categories above means something... not sure what... maybe someone at mathoverflow can answer that.

  • Speaking of mathoverflow, that's where to go for Ego Therapy. If you think you're really smart try answering some of their questions.

  • If your head doesn't explode first, you will come away with shoulders slumped and a humbler view of your place in the universe.

  • Unless you really are smart. In which case please don't stare at me :)

  • Some of the other sites are pretty interesting and a lot less intimidating.
Here's the full list at the end of 2009...

Monday, January 11, 2010

Crosstab, Rotate, Pivot

Shameless promotion, that's what the title is all about: Include all the keywords anyone might use when asking this question:

Question: How do I rotate a table so that different row values in a single column become different columns in a new table?

Answer: I could have sworn I talked about this years ago, but apparently not... at least not anywhere people can find it.

Is that a subtle dig at the NNTP newsgroups? Yes, I'm sorry, it is... I'll try to be less subtle: NNTP sucks, the days of the newsgroups are numbered, and the future for SQL Anywhere questions and answers lies with SQLA! <g>
SQL Anywhere doesn't have the ability to rotate (crosstab, pivot, whatever) a table, and that feature isn't coming any time soon. What it does have is EXECUTE IMMEDIATE, plus the ability to code IF expressions just about anywhere in the SELECT statement. You can combine those two features to kludge a solution.
Is "kludge" too strong a word? Maybe so, since performance is pretty good. Good enough for this technique to be used in real time by the Foxhound database monitor when analyzing data gathered from thousands of database connections. But, no question... the code's funky.
It's actually hard to explain what rotating a table is all about, it's not exactly as simple as turning rows into columns and vice versa... it's easier to use an example.

Here's a table showing sales by state and quarter:

-- Part 1: Initialize data.

BEGIN
DROP TABLE t1;
EXCEPTION WHEN OTHERS THEN
END;

CREATE TABLE t1 (
c1 VARCHAR ( 10 ) NOT NULL,
c2 VARCHAR ( 10 ) NOT NULL,
c3 INTEGER NOT NULL,
PRIMARY KEY ( c1, c2 ) );

INSERT t1 VALUES ( 'CA', 'Q1', 1000 );
INSERT t1 VALUES ( 'CA', 'Q2', 2000 );
INSERT t1 VALUES ( 'CA', 'Q3', 9000 );
INSERT t1 VALUES ( 'CA', 'Q4', 7000 );

INSERT t1 VALUES ( 'NY', 'Q1', 4000 );
INSERT t1 VALUES ( 'NY', 'Q2', 5000 );
INSERT t1 VALUES ( 'NY', 'Q3', 1000 );
INSERT t1 VALUES ( 'NY', 'Q4', 6000 );

INSERT t1 VALUES ( 'FL', 'Q1', 9000 );
INSERT t1 VALUES ( 'FL', 'Q2', 7000 );
INSERT t1 VALUES ( 'FL', 'Q3', 2000 );
INSERT t1 VALUES ( 'FL', 'Q4', 1000 );

INSERT t1 VALUES ( 'AZ', 'Q1', 5000 );
INSERT t1 VALUES ( 'AZ', 'Q2', 5000 );
INSERT t1 VALUES ( 'AZ', 'Q3', 1000 );
INSERT t1 VALUES ( 'AZ', 'Q4', 3000 );

INSERT t1 VALUES ( 'MA', 'Q1', 2000 );
INSERT t1 VALUES ( 'MA', 'Q2', 6000 );
INSERT t1 VALUES ( 'MA', 'Q3', 5000 );
INSERT t1 VALUES ( 'MA', 'Q4', 3000 );
COMMIT;

SELECT * FROM t1 ORDER BY c1, c2;

So far, so good... the table is nicely normalized, everything's elegant... and useless:

c1 c2 c3
AZ Q1 5000
AZ Q2 5000
AZ Q3 1000
AZ Q4 3000
CA Q1 1000
CA Q2 2000
CA Q3 9000
CA Q4 7000
FL Q1 9000
FL Q2 7000
FL Q3 2000
FL Q4 1000
MA Q1 2000
MA Q2 6000
MA Q3 5000
MA Q4 3000
NY Q1 4000
NY Q2 5000
NY Q3 1000
NY Q4 6000

What folks often want to see is something like this, sales by quarter for each state:

c2 AZ CA FL MA NY
Q1 5000 1000 9000 2000 4000
Q2 5000 2000 7000 6000 5000
Q3 1000 9000 2000 5000 1000
Q4 3000 7000 1000 3000 6000

Here's how you can do that in SQL Anywhere:

-- Part 2: Pivot c1 values into columns.

BEGIN
DECLARE @sql LONG VARCHAR;
SET @sql = 'SELECT c2';
FOR f_fetch
AS c_fetch NO SCROLL CURSOR FOR
SELECT DISTINCT t1.c1 AS @c1
FROM t1
ORDER BY t1.c1
FOR READ ONLY
DO
SET @sql = STRING (
@sql,
', SUM ( ( IF t1.c1 = ''',
@c1,
''' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "',
@c1,
'"' );
END FOR;
SET @sql = STRING (
@sql,
' INTO #t1 FROM t1 GROUP BY c2' );
MESSAGE @sql TO CONSOLE;
EXECUTE IMMEDIATE @sql;
SELECT * FROM #t1 ORDER BY c2; -- pivot table
END;

What if you want to see sales by state for each quarter?

c1 Q1 Q2 Q3 Q4
AZ 5000 5000 1000 3000
CA 1000 2000 9000 7000
FL 9000 7000 2000 1000
MA 2000 6000 5000 3000
NY 4000 5000 1000 6000

Here's the code for that:

-- Part 3: Pivot c2 values into columns.

BEGIN
DECLARE @sql LONG VARCHAR;
SET @sql = 'SELECT c1';
FOR f_fetch
AS c_fetch NO SCROLL CURSOR FOR
SELECT DISTINCT t1.c2 AS @c2
FROM t1
ORDER BY t1.c2
FOR READ ONLY
DO
SET @sql = STRING (
@sql,
', SUM ( ( IF t1.c2 = ''',
@c2,
''' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "',
@c2,
'"' );
END FOR;
SET @sql = STRING (
@sql,
' INTO #t1 FROM t1 GROUP BY c1' );
MESSAGE @sql TO CONSOLE;
EXECUTE IMMEDIATE @sql;
SELECT * FROM #t1 ORDER BY c1; -- pivot table
END;

Here's where the magic lies, in the SUMs of row values multiplied by 1 or 0; the following SELECT statements are generated by the code shown above:

SELECT c2,
SUM ( ( IF t1.c1 = 'AZ' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "AZ",
SUM ( ( IF t1.c1 = 'CA' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "CA",
SUM ( ( IF t1.c1 = 'FL' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "FL",
SUM ( ( IF t1.c1 = 'MA' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "MA",
SUM ( ( IF t1.c1 = 'NY' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "NY"
INTO #t1
FROM t1
GROUP BY c2

SELECT c1,
SUM ( ( IF t1.c2 = 'Q1' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "Q1",
SUM ( ( IF t1.c2 = 'Q2' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "Q2",
SUM ( ( IF t1.c2 = 'Q3' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "Q3",
SUM ( ( IF t1.c2 = 'Q4' THEN 1 ELSE 0 ENDIF ) * t1.c3 ) AS "Q4"
INTO #t1
FROM t1
GROUP BY c1

The "SUM IF 1 OR 0" trick is an old one, used by generations of programmers to write funky code for icky problems, and not just in SQL. In fact, the code shown above is really simple compared with what goes on in the world, just a starting point.

If folks are interested I've got a couple of other demos that build on this technique... not the raw incomprehensible code you find in real-world applications, but hammered down into the basics for presentation... that's actually harder to do, the hammering down, harder than writing the original incomprehensible stuff :)

Monday, December 28, 2009

The beta is awesome! (2)

It's a big step for Foxhound when a new version of SQL Anywhere is released.

First, Foxhound has compile on Version 12, then it has to run properly against target databases created with versions 5.5 through 11.

What is Foxhound? It's a database monitor and schema display utility for SQL Anywhere databases, currently in development with its own beta planned for 2010.
Foxhound also has to recognize target databases created with version 12, and then it has to work properly with those target databases... it's one thing to get Foxhound to stop rejecting "12" as a database version number, quite another matter to get Foxhound to handle version 12's enhancements and behavior changes.

But, first things first: Foxhound compiles cleanly on the SQL Anywhere version 12 beta with no code changes, and it passes a simple smoke test.

Woohoo! That's no mean feat... virtually all of Foxhound is written in SQL...
  • 80,000 lines of rather funky Watcom SQL, up from 60,000 lines a year ago,

  • 200 web services, procedures, events and triggers,

  • 340 tables and views with 2600 columns, plus

  • 1,300 lines of C in 9 external procedures.
So, thank you, iAnywhere Solutions, for (a) not shipping broken code and (b) not breaking my code!

Tuesday, December 22, 2009

When will SQLA go live?

The SQL Anywhere question & answer site SQLA will probably go live sometime in 2010, possibly before the US midterm elections (what, isn't EVERYONE waiting to see what happens on November 2? :)

Here are some points to consider:

...and maybe there will be a Beta 8, who knows?
  • There are a lot of little bugs in the underlying software, you've probably seen them and been just as irritated by them as I have. Feel free to report them on meta.stackexchange.com, but if you do, you'll probably see they've already been discussed... which is why I don't bother sweating the small stuff.

  • There are quite a few features that are "stubbed out" (not yet implemented) in the administration areas "admin", "mod" and "tools". The big one, IMO, is called "Download Your StackExchange Database". That's huge. SQLA will never go live without that one.

Not ever.


Allow me to elaborate: The creator of StackExchange just lost his entire blog because he didn't take responsibility for backing up his own data. SQLA is not my data, it is your data. It's one thing for Jeff Atwood to be careless with his own data, that's his problem. It would be an entirely different matter for me to take the same risks with your data. I don't care how safe the Fog Creek infrastructure is... blah blah blah cloud computing blah blah blah.



Until there is a reasonably convenient and absolutely reliable way for me to back up SQLA content, it ain't ever going live.



Here's what I really think: The backup problem will go away long before StackExchange goes live, and we'll be able to "pump up the volume" (invite more participation in SQLA) sometime in January or February.

That will happen before SQLA goes "live"... it will still say "govern yourself accordingly", but it'll be a lot more fun!

Saturday, December 19, 2009

The beta is awesome!

I'm probably violating some part of the EULA just by saying that, but I don't care.

Folks who join the SQL Anywhere 12 beta can read my article "Top 1 Cool New Features In SQL Anywhere 12" in the beta newsgroup... that's where I talk about how much adjective deleted noun deleted are.

Then there's the follow up "Top 2 Cool New Features In SQL Anywhere 12" where I discover the new noun deleted feature.

The best part, it hasn't verb deleted, not once!

Tuesday, December 15, 2009

Good Luck Glenn!

Good luck Glenn, on today's webcast....

Object Relational Mappers: Friend or Foe?


Join the SQL Anywhere experts for a deep dive discussion on Object Relational Mappers.

Object relational mappers (ORMs) such as LINQ, Hibernate, and ActiveRecord bridge the gap between the relational database world, and the object-oriented world. By abstracting the database into "virtual database objects", they let programmers develop in any language and environment that they like without ever writing a line of SQL. It sounds great, but is the ORMs sweet song actually a siren's call? This talk will put ORMs on trial to help us find the answer.

Presenter: Glenn Paulley, Director of Engineering

Date: Tuesday December 15th
Time: 7am PST / 10am EST / 3pm GMT / 4pm CET
or 11am PST / 2pm EST / 7pm GMT / 8pm CET

Thursday, December 10, 2009

Why SQLA Exists

The SQL Anywhere question and answer website SQLA exists for questions like this

What particular statistics should one look at to help decide the best database page size to use?
and answers like this.

That doesn't mean you can't ask questions like "Where does the semicolon go?", those are perfectly fine and will be answered quickly and politely... but you've gotta appreciate the gems!

Monday, December 7, 2009

Object Relational Mappers: Friend or Foe?

Folks who know me, even just a little, know where I stand on the subject of Object Relational Mappers: Friend or Foe?

For everyone else, here's a hint: ORMs are like this Safety Device for Walking on Icy Pavements...



When you slip on ice, your foot kicks paddle (A), lowering finger (B), snapping turtle (C) extends neck to bite finger, opening ice tongs (D) and dropping pillow (E), thus allowing you to fall on something soft.

Which brings us to this webcast...

...I can't wait to hear what Glenn has to say!

Object Relational Mappers: Friend or Foe?

Join the SQL Anywhere experts for a deep dive discussion on Object Relational Mappers.

Object relational mappers (ORMs) such as LINQ, Hibernate, and ActiveRecord bridge the gap between the relational database world, and the object-oriented world. By abstracting the database into "virtual database objects", they let programmers develop in any language and environment that they like without ever writing a line of SQL. It sounds great, but is the ORMs sweet song actually a siren's call? This talk will put ORMs on trial to help us find the answer.

Presenter: Glenn Paulley, Director of Engineering

Date: Tuesday December 15th
Time: 7am PST / 10am EST / 3pm GMT / 4pm CET
or 11am PST / 2pm EST / 7pm GMT / 8pm CET