DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

4D


4D is a relational DBMS that is integrated with an IDE and a proprietary programming language. It allows users to create custom graphical interfaces to work with their database, which can then be run on Windows or Mac OS systems to edit a locally stored database file. 4D can also run as a server so that multiple clients can manage a single database. A companion product, "4D for iOS Preview", creates a customizable iOS app for viewing database contents.[04][05][03]

Country of Origin
FR
Start Year
1984 [26]
Former Names
4th Dimension, Silver Surfer
Project Type
Commercial
Operating Systems
iOS, macOS, Windows
License
Proprietary

Database Entry

4D


4D is a relational DBMS that is integrated with an IDE and a proprietary programming language. It allows users to create custom graphical interfaces to work with their database, which can then be run on Windows or Mac OS systems to edit a locally stored database file. 4D can also run as a server so that multiple clients can manage a single database. A companion product, "4D for iOS Preview", creates a customizable iOS app for viewing database contents.[04][05][03]

History


4D was originally developed under the name "Silver Surfer" in the 1980s as a DBMS for the Macintosh platform.

Checkpoints[06][07][08]


Every modification to the data file since the last backup is recorded in the associated log file. If the database file is corrupted, 4D will restore the most recent backup and replay the changes in the log. When a new backup is created, the log file is cleared. Backups can be triggered manually or on a schedule. The database cannot be edited while a backup is running.

Compression[09][10]


4D Web Server supports using gzip compression when communicating with clients. Gzip compression can also be used to shrink BLOB objects stored in the database. The 4D documentation does not mention support for any other types of compression.

Concurrency Control[11][12][13]


4D requires users to explicitly lock/unlock records and avoid deadlocks. For every user/process, each table in the database is given a read-only or read/write status. If a table is in the read-only state for a given user, all existing records loaded from the table are considered locked and cannot be modified. Any user can append new records to a table, even if it is read-only. If a table is in the read/write state, records will load as unlocked for the first user to load them. To modify a record that is already locked, a user can repeatedly load the record until it unlocks. A user unloads a record to make it available again to other users/processes.

A user can change a table from read-only to read/write or back at any time, but this only affects future load requests made by that user. If a read/write command is executed on a locked record, the command will either be ignored, display an error, or skip the record (if the command targets multiple records). Skipped records are added to the LockedSet of the requesting process to alert it of the error.

Queries can be grouped into transactions to ensure that changes occur atomically, but there is no deadlock prevention/detection. While a transaction is running, changes are saved into a temporary buffer and any modified records are locked.

Data Model[14]


4D uses a standard relational database structure with tables, fields, and relations.

Foreign Keys[15]


4D supports One-to-One, Many-to-One, and Many-to-Many relations between tables. Relations are classified as either automatic or manual. Automatic relations cause foreign records to be loaded with records that reference them, while manual relations do not. Automatic relations should avoid cyclic references.

Hardware Acceleration[16]


The 4D documentation makes no mention of hardware acceleration.

Indexes[17]


Indices can use a B+Tree or clustered B+Tree. 4D supports composite indices (indices on pairs of values). It also supports keyword indices (indices mapping individual words to records containing them).

Isolation Levels[18][13]


Transactions lock records they modify or create, preventing other transactions from interfering with them. Unrepeatable reads may occur since transactions do not lock records they read. Table entries can be added while a transaction is running, creating invalid aggregation results (phantom problem). Transactions store all modifications in a temporary buffer, so uncommitted data can't affect other transactions.

Isolations levels for 4D transactions are not mentioned in the product documentation, but the behavior is consistent with the Read Committed isolation level.

Logging[19][20]


When a new data file is created, 4D automatically generates a log file for it with the ".journal" extension. The log file contains a record of all modifications since the last database backup. Entries describe the change that was performed as well as the user and time of the modification. The log also records when a user opens/closes the database.

Parallel Execution[21]


4D does not automatically utilize parallelism, but users can manually exploit parallelism by running multiple processes. Concurrency control and record locking for multiple 4D processes is handled similarly to multi-user scenarios.

Query Compilation[22]


The 4D language can be either interpreted or compiled. By default, an interpreter is used. A built-in compiler can convert the database application into machine code to increase performance.

Query Interface[23][24]


4D provides a graphical interface for managing data in a 4D database. Developers can customize the interface using the proprietary 4D programming language to provide additional buttons/forms for data manipulation. The language has syntax for control flow, variable creation, and database queries.

4D includes a SQL engine and the language supports inline SQL queries, though any SQL functionality can be replicated using the 4D language.

Storage Architecture[06]


4D database files are stored on disk. An in-memory cache is used to improve performance, but transactions are immediately written to the on-disk log file when they are committed.

Storage Model[25]


A 4D database consists of: - A structure file describing the database schema - A data file (records stored in a row store format) - A log file for data recovery - A Resource folder containing images/assets for any custom UI - A preferences folder

Citations

26 sources
  1. Fast development platform for business apps | 4D 4d.com
  2. https://doc.4d.com/4Dv21R2/index.en.html 4d.com
  3. 4th Dimension (software) - Wikipedia wikipedia.org
  4. Why 4D | 4D 4d.com
  5. FAQ · 4D for iOS 4d.com
  6. https://doc.4d.com/4Dv16/4D/16.6/Managing-the-log-file.300-4460832.en.html 4d.com
  7. https://doc.4d.com/4Dv16/4D/16.6/Backing-up-the-database.300-4460834.en.html 4d.com
  8. https://doc.4d.com/4Dv16/4D/16.6/Automatic-backup-strategy.300-4460828.en.html 4d.com
  9. https://doc.4d.com/4Dv15/4D/15.6/Web-Server-Overview.300-3817736.en.html 4d.com
  10. https://doc.4d.com/4Dv15/4D/15.6/COMPRESS-BLOB.301-3818262.en.html 4d.com
  11. https://doc.4d.com/4Dv15/4D/15.6/Record-Locking.300-3817815.en.html 4d.com
  12. https://doc.4d.com/4Dv17R6/4D/17-R6/SUSPEND-TRANSACTION.301-4310490.en.html 4d.com
  13. https://doc.4d.com/4Dv17R6/4D/17-R6/Using-Transactions.300-4310489.en.html 4d.com
  14. https://docs.4d.com/4Dv17R6/4D/17-R6/Database-basics.300-4354732.en.html 4d.com
  15. https://docs.4d.com/4Dv17R6/4D/17-R6/Types-of-relations.300-4354745.en.html 4d.com
  16. https://doc.4d.com/4DACTION/SearchResults_mc/acceleration/4309689-0/false.en.html 4d.com
  17. https://doc.4d.com/4Dv17R6/4D/17-R6/Creating-and-modifying-indexes.300-4354741.en.html 4d.com
  18. https://doc.4d.com/4Dv17R6/4D/17-R6/Suspending-transactions.300-4310493.en.html 4d.com
  19. https://doc.4d.com/4Dv16/4D/16.6/Activity-analysis-page.300-4460774.en.html 4d.com
  20. https://doc.4d.com/4Dv15/4D/15.6/Managing-the-log-file.300-3836694.en.html 4d.com
  21. https://doc.4d.com/4Dv16/4D/16.6/Processes.300-4445228.en.html 4d.com
  22. https://doc.4d.com/4Dv15/4D/15.6/Overview.300-3836595.en.html 4d.com
  23. https://doc.4d.com/4Dv16/4D/16.6/Introduction-to-the-4D-Language.300-4444953.en.html 4d.com
  24. https://doc.4d.com/4Dv16/4D/16/Accessing-the-4D-SQL-Engine.300-3201186.en.html 4d.com
  25. https://doc.4d.com/4Dv15/4D/15.6/Description-of-4D-files.300-3836852.en.html 4d.com
  26. About us | 4D 4d.com
Revision #18