Escaping the Database Doldrums

toward a True RDBMS via free software and IETF methodologies

James K. Lowden

Maintainer, FreeTDS

picture of jim

Uncle Codd wants you

Parallel Universes

Year Berkeley Armonk
1970 four nodes A Relational Model of Data for Large Shared Data Banks
1988 SQL an International Standard

Relational technology worthy

Relational technology interesting

Why Do You Care?

[any material that should appear in print but not on the slide]

Hacking for Fun and Profit

[any material that should appear in print but not on the slide]

RDBMS: Honored in the Breach

Vendors Have Not Delivered

The Market Is an Idiot

The customers’ cost is the vendors’ gain!

Relational Algebra is your friend

Read

  • Union
  • Intersection
  • Difference
  • Cartesian Product
  • Select (a/k/a Restrict)
  • Project
  • Join

Write

  • Insert
  • Modify
  • Delete

Relational Good, SQL bad

SQL Not Orthogonal
constructor compare assign selector gen expr
table no no only via INSERT - SELECT yes no
column only as arg to IN no no yes no
row only in INSERT & UPDATE no only to/from set of host scalars (yes) no
scalar N/A yes only to/from host scalar (yes) no

Credit: Chris Date A Critique of the SQL Database Language [pdf] December 1983

Much money, no progress

Column names matter

SQL
SELECT DISTINCT E#, TOTAL_PAY 
FROM ( SELECT E#, SALARY + BONUS AS TOTAL_PAY 
FROM EMP ) AS TEETH_GNASHER 
WHERE TOTAL_PAY >= 5000
Tutorial D
( ( EXTEND EMP ADD SALARY+BONUS AS TOTAL_PAY ) 
WHERE TOTAL_PAY >= 5000 ) { E#, TOTAL_PAY } 

credit: The Importance of Column Names by Hugh Darwen

Free RDBMS Errors

Free RDBMS Opportunites

Embrace Relational Theory

Support scientific computing

Adopt One Wire Protocol

Adopt One API

RDBMS Bind Function
ODBC (per column) SQLRETURN SQLBindCol( STMT Handle, int col, int type, BYTE *buf, int len, int *indicator);
Ingres
II_VOID IIapi_getDescriptor (IIAPI_GETDESCRPARM *getDescrParm); 
typedef struct _IIAPI_GETDESCRPARM 
{ 
 IIAPI_GENPARM gd_genParm; 
 II_PTR   gd_stmtHandle; 
 II_LONG  gd_descriptorCount; 
 IIAPI_DESCRIPTOR *gd_descriptor; 
} IIAPI_GETDESCRPARM;
SQLite
int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
int sqlite3_bind_double(sqlite3_stmt*, int, double);
int sqlite3_bind_int(sqlite3_stmt*, int, int);
int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
int sqlite3_bind_null(sqlite3_stmt*, int);
int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
MySQL (strings only) MYSQL_ROW mysql_fetch_row(MYSQL_RES *result);
Postgres (string or unconverted) char *PQgetvalue(const PGresult *res, int row, int col);
int PQgetisnull(const PGresult *res, int row, int col);

ODBC Is Not the Answer

Use stdio as a Model

Hello Armonk, this is Berkeley

We are not alone

Uncle Codd needs you

Next Steps

[-any material that should appear in print but not on the slide]