Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Important is SQL Portability?

It seems to me, from both personal experience and SO questions and answers, that SQL implementations vary substantially. One of the first issues for SQL questions is: What dbms are you using?

In most cases with SQL there are several ways to structure a given query, even using the same dialect. But I find it interesting that the relative portability of various approaches is frequently not discussed, nor valued very highly when it is.

But even disregarding the likelihood that any given application may or not be subject to conversion, I'd think that we would prefer that our skills, habits, and patterns be as portable as possible.

In your work with SQL, how strongly do you prefer standard SQL syntax? How actively do you eschew propriety variations? Please answer without reference to proprietary preferences for the purpose of perceived better performance, which most would concede is usually a sufficiently legitimate defense.

like image 655
dkretz Avatar asked Apr 02 '09 07:04

dkretz


People also ask

What is data portability and why is it important?

Data portability is the concept that the users or owners of a given dataset should be able to easily move or copy this data between different software applications, platforms, services, and computing environments.

Why is SQL such an important tool for data management?

These are just a few of the many reasons why SQL is such an important tool for data management. When used correctly, it can make retrieving and processing data much faster and easier than other methods. So if you’re looking for a more efficient way to work with your data, consider using SQL. It could make all the difference. 1.

Why is SQL still relevant?

Your knowledge is focused on your specific version of SQL. SQL is not simply relevant because of the ability to normalize an otherwise confusing language, but it provides two other unique features. On the one hand, it is tremendously flexible and powerful. On the other hand, it is very accessible, which makes it easier to master.

What is software portability?

We might use the word portability, then, in very general terms, as a characteristic of software: highly portable software can be written once and deployed anywhere. Portable applications require less development and operational effort even as they are exposed to more potential users.


2 Answers

I vote against standard/vendor independent sql

  • Only seldom the database is actually switched.
  • There is no single database that fully conforms to the current sql standard. So even when you are standard conform, you are not vendor independent.
  • vendor differences go beyond sql syntax. Locking behaviour is different. Isolation levels are different.
  • database testing is pretty tough and under developed. No need to make it even harder by throwing multiple vendors in the game, if you don't absolutly need it.
  • there is a lot of power in the vendor specific tweaks. (think 'limit', or 'analytic functions', or 'hints' )

So the quintessence: - If there is no requirement for vendor independence, get specialised for the vendor you are actually using. - If there is a requirement for vendor independence make sure that who ever pays the bill, that this will cost money. Make sure you have every single rdbms available for testing. And use it too - Put every piece of sql in a special layer, which is pluggable, so you can use the power of the database AND work with different vendors - Only where the difference is a pure question of syntax go with the standard, e.g. using the oracle notation for (outer) joins vs the ANSI standard syntax.

like image 137
Jens Schauder Avatar answered Oct 21 '22 11:10

Jens Schauder


We take it very seriously at our shop. We do not allow non-standard SQL or extensions unless they're supported on ALL of the major platforms. Even then, they're flagged within the code as non-standard and justifications are necessary.

It is not up to the application developer to make their queries run fast, we have a clear separation of duties. The query is to be optimized only by the DBMS itself or the DBAs tuning of the DBMS.

Real databases, like DB2/z :-), process standard SQL plenty fast.

The reason we enforce this is to give the customer choice. They don't like the idea of being locked into a specific vendor any more than we do.

like image 22
paxdiablo Avatar answered Oct 21 '22 09:10

paxdiablo