Let's shit on SQL a bit more.

This commit is contained in:
Philippe PITTOLI 2024-05-14 13:51:13 +02:00
parent fc52757074
commit 03da23e8e2
2 changed files with 67 additions and 15 deletions

View File

@ -8,42 +8,93 @@ DODB is a database-as-library, enabling a very simple way to store applications'
To speed-up searches, attributes of these documents can be used as indexes which leads to create a few symbolic links To speed-up searches, attributes of these documents can be used as indexes which leads to create a few symbolic links
.I symlinks ) ( .I symlinks ) (
on the disk. on the disk.
.br
This document briefly presents DODB and its main differences with other database engines. This document briefly presents DODB and its main differences with other database engines.
An experiment is described and analysed to understand the performance that can be expected from this approach. An experiment is described and analysed to understand the performance that can be expected from this approach.
.ABSTRACT2 .ABSTRACT2
.SINGLE_COLUMN
.SECTION Introduction to DODB .SECTION Introduction to DODB
A database consists in managing data, enabling queries (preferably fast) to retrieve, to modify, to add and to delete a piece of information. A database consists in managing data, enabling queries (preferably fast) to retrieve, to modify, to add and to delete a piece of information.
Anything else is Anything else is
.UL accessory . .UL accessory .
Universities all around the world teach about Structured Query Language (SQL) and relational databases. Universities all around the world teach about Structured Query Language (SQL) and relational databases.
.
.de PRIMARY_KEY
.I \\$1 \\$2 \\$3
..
.de FOREIGN_KEY
.I \\$1 \\$2 \\$3
..
The main idea of relational databases is to put data into .UL "Relational databases"
are built around the idea to put data into
.I tables , .I tables ,
with typed columns so the database can optimize operations and storage. with typed columns so the database can optimize operations and storage.
A database is a list of tables with relations between them. A database is a list of tables with relations between them.
For example, let's imagine a database of a For example, let's imagine a database of a movie theater.
The database will have a
.I table .I table
can contain a list of users (their age, height, job, etc.). for the list of movies they have
When another .PRIMARY_KEY idmovie , (
title, duration, synopsis),
a table for the scheduling
.PRIMARY_KEY idschedule , (
.FOREIGN_KEY idmovie ,
.FOREIGN_KEY idroom ,
time slot),
a table for the rooms
.PRIMARY_KEY idroom , (
name), etc.
Tables have relations, for example the table "scheduling" has a column
.I idmovie
which points to entries in the "movie" table.
The SQL language enables arbitrary operations on databases: add, modify and delete entries. .UL "The SQL language"
Furthermore, SQL enables even to manage administrative operations of the databases themselves: managing users with fine-grained authorizations, creating databases and tables, etc. enables arbitrary operations on databases: add, search, modify and delete entries.
Furthermore, SQL also enables to manage administrative operations of the databases themselves: creating databases and tables, managing users with fine-grained authorizations, etc.
This language is used in applications to perform operations on the database, binding the code with the database.
SQL is also used
.UL outside
the application, by admins for managing databases and potentially by some technical users to retrieve some data without a dedicated interface\*[*].
.FOOTNOTE1
One of the first objectives of SQL was to enable a class of
.I non-developer
users to talk directly to the database so they can access the data without bothering the developers.
.FOOTNOTE2
Many tools were used or even developed over the years specifically to aleviate the inherent complexity and limitations of SQL. Many tools were used or even developed over the years specifically to aleviate the inherent complexity and limitations of SQL.
For example, Unified Modeling Language (UML) is used to design databases by providing a graphical overview of the relations between tables. For example, designing databases becomes difficult when the list of tables grows;
SQL databases can be scripted to automate operations and provide a massive speed up to the operations ( Unified Modeling Language (UML) is then used to provide a graphical overview of the relations between tables.
.I "stored procedures" , SQL databases may be fast to retrieve data despite complicated operations, but when multiple sequential operations are required they become slow because of all the back-and-forths with the application;
thus, SQL databases can be scripted to automate operations and provide a massive speed up
.I "stored procedures" , (
see see
.I "PL/SQL" ), .I "PL/SQL" ).
etc. Writing SQL requests requires a lot of boiletplate since there is no integration in the programming languages, leading to multiple function calls for any operation on the database;
thus, object-relational mapping (ORM) libraries were created to reduce the massive code duplication.
And so on.
For many reasons, SQL is not a silver bullet to
.I solve
the database problem.
The encountered difficulties mentioned above and the original objectives of SQL not being universal\*[*], other database designs were created\*[*].
.FOOTNOTE1
To say the least!
Not everyone needs to let users access the database without going through the application.
For instance, writing a \f[I]blog\f[] for a small event or to share small stories about your life doesn't require manual operations on the database, fortunately.
.FOOTNOTE2
.FOOTNOTE1
A lot of designs won't be mentioned here.
The actual history of databases is often quite unclear since the categories of databases are sometimes vague, underspecified.
As mentioned, SQL is not a silver bullet and a lot of developers shifted towards other solutions, that's the important part.
.FOOTNOTE2
.TBD
The
Document-oriented databases are key-value stores. Document-oriented databases are key-value stores.
Furthermore, metadata is extracted for further optimization. Furthermore, metadata is extracted for further optimization.
Contrary to SQL, DODB has a very narrow scope: to provide Contrary to SQL, DODB has a very narrow scope: to provide a library enabling to store, retrieve, modify and delete data to the application.
Thus, DODB doesn't provide an interactive shell, no request language to perform arbitrary operations on the database, etc. Thus, DODB doesn't provide an interactive shell, no request language to perform arbitrary operations on the database, etc.
.SECTION Basic usage .SECTION Basic usage

View File

@ -1,6 +1,6 @@
.\" .RP = report document .\" .RP = report document
.nr PO 0.5i \" page offset default 1i .nr PO 0.5i \" page offset default 1i
.nr LL 7.5i \" line length default 6i .nr LL 7.0i \" line length default 6i
.nr FM 0.8i \" page foot margin default 1i .nr FM 0.8i \" page foot margin default 1i
.nr DI 0 .nr DI 0
.nr FF 3 \" footnotes' type: numbered, with point, indented .nr FF 3 \" footnotes' type: numbered, with point, indented
@ -188,7 +188,8 @@ accumulate
.. ..
.de SINGLE_COLUMN .de SINGLE_COLUMN
.1C .1C
.FOOTNOTE_TO_COLUMN_WIDTH .\" .FOOTNOTE_TO_COLUMN_WIDTH
.nr FL (\n[LL]*97/100)
.. ..
.de TWO_COLUMNS .de TWO_COLUMNS
.2C .2C