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 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.[05][04][06]
- Website
- https://us.4d.com[01]
- Developer
- Country of Origin
- FR
- Start Year
- 1984 [07]
- Former Names
- 4th Dimension, Silver Surfer
- Project Type
- Commercial
- Supported Languages
- SQL
- License
- Proprietary
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 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.[05][04][06]
History[07][08]
4D was originally developed under the name "Silver Surfer" in the 1980s as a DBMS for the Macintosh platform. Apple canceled the project after receiving pressure from 3rd party software developers who feared the product would have an unfair competitive advantage if Apple released it. The project lead, Laurent Ribardière, left Apple and continued to develop the DBMS, ultimately releasing it under the name 4th Dimension. The product gained popularity for its user-friendly interface and ability to handle large amounts of data. 4D later added features like SQL support and a web server to keep up with newer systems. The product is still under active development and used by many companies.
Checkpoints[09][10][11]
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[12][13]
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[14][15][16]
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.
Foreign Keys[18]
4D supports one-to-one, many-to-one, and many-to-many relations between tables. Relations are classified as either automatic or non-automatic. Automatic relations cause foreign records to be loaded with records that reference them, while non-automatic relations do not. Automatic relations should avoid cyclic table references.
Indexes[20]
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[21][16]
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.
Joins[22][23][24][25][26]
Queries involving joins are invoked with the "query" and "query by formula" commands in the 4D language. If an index is available, 4D will perform an index nested loop join or an ordinary nested loop join, depending on which is faster given the table sizes. If no index is present, the documentation states that 4D uses the join algorithm used by its SQL engine (presumably Hash Join). The "relate one" and "relate many" commands are also similar to a join on a primary key. They fetch records directly using the primary key, if possible.
Logging[27][28]
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[29]
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[30]
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 Execution[31][32][33]
The 4D query command outputs a selection (subset) of records from a single table. The selection is the set of records that satisfy the query parameters. If the table has any automatic relations, fields from related tables can be referenced in the filtering criteria. The selection can be stored as a named set or combined with other sets using union/intersection commands. Since each set is fully generated before further processing, this is best classified as a materialized model.
Query Interface[24][34][35]
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[09]
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[36]
A 4D database primarily consists of a structure file (for storing the schema), a data file (records stored in a row store format), and a log file for crash recovery. The database also has preferences folder and a resources folder with images/assets used for custom UI. Indices are stored in an index file.
Stored Procedures[37]
4D supports saving 4D language scripts to a 4D server as stored procedures. Scripts stored on a server can be invoked by a remote client. Stored procedures run on the server, making them more efficient than running the query locally and making many remote calls.
System Architecture[38]
4D is designed to be run on a single server machine, though it can be accessed by multiple remote clients.
Views[39][40]
4D supports virtual views as part of its SQL engine. It also has dynamic forms which can display dynamically generated information next to a list of records. This information is regenerated every time the form is loaded.
Citations
40 sources- Fast development platform for business apps | 4D 4d.com
- https://doc.4d.com/4Dv21R2/index.en.html 4d.com
- 4D Blog - All the latest tech info by our 4D bloggers: feature presentation with database examples, videos, technical info, and updates on events. 4d.com
- 4th Dimension (software) - Wikipedia wikipedia.org
- Why 4D | 4D 4d.com
- FAQ · 4D for iOS 4d.com
- About us | 4D 4d.com
- NEW DATABASE SOFTWARE PROGRAM MOVES MACINTOSH INTO THE BIG LEAGUES – Chicago Tribune chicagotribune.com
- https://doc.4d.com/4Dv16/4D/16.6/Managing-the-log-file.300-4460832.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16.6/Backing-up-the-database.300-4460834.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16.6/Automatic-backup-strategy.300-4460828.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Web-Server-Overview.300-3817736.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/COMPRESS-BLOB.301-3818262.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Record-Locking.300-3817815.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/SUSPEND-TRANSACTION.301-4310490.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/Using-Transactions.300-4310489.en.html 4d.com
- https://docs.4d.com/4Dv17R6/4D/17-R6/Database-basics.300-4354732.en.html 4d.com
- https://docs.4d.com/4Dv17R6/4D/17-R6/Types-of-relations.300-4354745.en.html 4d.com
- https://doc.4d.com/4DACTION/SearchResults_mc/acceleration/4309689-0/false.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/Creating-and-modifying-indexes.300-4354741.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/Suspending-transactions.300-4310493.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/RELATE-MANY.301-4310983.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/RELATE-ONE.301-4310994.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Principles-for-searching-in-4D.300-3836667.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/QUERY-BY-FORMULA.301-4311071.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/DESCRIBE-QUERY-EXECUTION.301-4311061.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16.6/Activity-analysis-page.300-4460774.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Managing-the-log-file.300-3836694.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16.6/Processes.300-4445228.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Overview.300-3836595.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/QUERY.301-4311074.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/ORDER-BY-FORMULA.301-4311064.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/4D-Server-Sets-and-Named-Selections.300-4362475.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16.6/Introduction-to-the-4D-Language.300-4444953.en.html 4d.com
- https://doc.4d.com/4Dv16/4D/16/Accessing-the-4D-SQL-Engine.300-3201186.en.html 4d.com
- https://doc.4d.com/4Dv15/4D/15.6/Description-of-4D-files.300-3836852.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/Stored-Procedures.300-4362474.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/4D-Server-Architecture.300-4362505.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/CREATE-VIEW.300-4463954.en.html 4d.com
- https://doc.4d.com/4Dv17R6/4D/17-R6/Output-forms.300-4354802.en.html 4d.com