\ No newline at end of file
diff --git a/about/buy/index.html b/about/buy/index.html
index 45b2eb0..3c949b0 100755
--- a/about/buy/index.html
+++ b/about/buy/index.html
@@ -1,4 +1,4 @@
- How to Buy - CrossDB
CrossDB Software has designed its website so that, in general, you can browse the CrossDB website without being asked for any personal information. Exceptions to this are when you specifically ask for information, request an evaluation copy of our software or download CrossDB trial software.
This policy covers how CrossDB Software treats personal information that CrossDB may collect and receive via the CrossDB website. Your use of the CrossDB website constitutes acceptance of and agreement with the CrossDB Software Privacy Policy. CrossDB reserves the right to change the CrossDB Software Privacy Policy at any time without notice.
CrossDB collects personal information when you request for information, request an evaluation of our software or when you download trial software. This information includes information about you such as name, business name and address, telephone and fax numbers, email address, operating system, and hardware environment. Providing information is voluntary. You may provide this information by filling out an on-line form, by email or other communication to CrossDB. However, you may not receive the product information, software evaluation or downloads if you choose not to provide the requested information.
CrossDB Software's use of the information you provided will be to send you the information that you requested. CrossDB Software may also use the information to provide you with additional information about our products and services or market research. The information may be used to follow up with you regarding information supplied, software you downloaded or evaluated.
CrossDB does not sell information collected from users of CrossDB website to other organizations. CrossDB may share the information collected with its subsidiaries and its affiliates such as partners and distributors.
CrossDB web servers record standard information about CrossDB Web accesses such as IP addresses, your server name, browser type, etc. when you visit our website. CrossDB uses this for information about usage at CrossDB Software's website. The information submitted to CrossDB Software via the Web may be processed, stored and used outside the country where it was submitted.
Links to third party websites are provided for your convenience. By using these links, you will no longer be on the CrossDB Software website and the CrossDB Software Privacy Policy will no longer apply.
If you have any question about the information you provided to us or about the CrossDB Software Privacy Policy, please contact us at support@crossdb.org
\ No newline at end of file
+ Privacy Notice - CrossDB
CrossDB Software has designed its website so that, in general, you can browse the CrossDB website without being asked for any personal information. Exceptions to this are when you specifically ask for information, request an evaluation copy of our software or download CrossDB trial software.
This policy covers how CrossDB Software treats personal information that CrossDB may collect and receive via the CrossDB website. Your use of the CrossDB website constitutes acceptance of and agreement with the CrossDB Software Privacy Policy. CrossDB reserves the right to change the CrossDB Software Privacy Policy at any time without notice.
CrossDB collects personal information when you request for information, request an evaluation of our software or when you download trial software. This information includes information about you such as name, business name and address, telephone and fax numbers, email address, operating system, and hardware environment. Providing information is voluntary. You may provide this information by filling out an on-line form, by email or other communication to CrossDB. However, you may not receive the product information, software evaluation or downloads if you choose not to provide the requested information.
CrossDB Software's use of the information you provided will be to send you the information that you requested. CrossDB Software may also use the information to provide you with additional information about our products and services or market research. The information may be used to follow up with you regarding information supplied, software you downloaded or evaluated.
CrossDB does not sell information collected from users of CrossDB website to other organizations. CrossDB may share the information collected with its subsidiaries and its affiliates such as partners and distributors.
CrossDB web servers record standard information about CrossDB Web accesses such as IP addresses, your server name, browser type, etc. when you visit our website. CrossDB uses this for information about usage at CrossDB Software's website. The information submitted to CrossDB Software via the Web may be processed, stored and used outside the country where it was submitted.
Links to third party websites are provided for your convenience. By using these links, you will no longer be on the CrossDB Software website and the CrossDB Software Privacy Policy will no longer apply.
If you have any question about the information you provided to us or about the CrossDB Software Privacy Policy, please contact us at support@crossdb.org
\ No newline at end of file
diff --git a/about/refund/index.html b/about/refund/index.html
index d5147a6..006c4e3 100755
--- a/about/refund/index.html
+++ b/about/refund/index.html
@@ -1 +1 @@
- Refund Policy - CrossDB
Thank you for using CrossDB Database! We don't offer refund, please try it first then subscribe the product by month or year. You can cancel the subscription anytime as you want.
\ No newline at end of file
+ Refund Policy - CrossDB
Thank you for using CrossDB Database! We don't offer refund, please try it first then subscribe the product by month or year. You can cancel the subscription anytime as you want.
\ No newline at end of file
diff --git a/about/terms/index.html b/about/terms/index.html
index a7d5252..ac781bb 100755
--- a/about/terms/index.html
+++ b/about/terms/index.html
@@ -1 +1 @@
- Terms of Service - CrossDB
CrossDB provides this Website for your information and use, subject to the terms set forth below. By accessing this Website, you agree to accept the following terms.
In no event will CrossDB be liable for any damages including, without limitation, indirect, incidental, consequential, special or exemplary damages, that arise out of or relate to the use of or inability to use the CrossDB Website, even if CrossDB has been advised of the possibility of such damages.
Any and all information provided on CrossDB’s Website is provided “as is,” with no warranty as to accuracy or content.
CrossDB does not adopt or endorse the views of any third party Websites linked to or from the CrossDB Website.
CrossDB reserves the right to change, modify, add or remove any of these terms at any time.
\ No newline at end of file
+ Terms of Service - CrossDB
CrossDB provides this Website for your information and use, subject to the terms set forth below. By accessing this Website, you agree to accept the following terms.
In no event will CrossDB be liable for any damages including, without limitation, indirect, incidental, consequential, special or exemplary damages, that arise out of or relate to the use of or inability to use the CrossDB Website, even if CrossDB has been advised of the possibility of such damages.
Any and all information provided on CrossDB’s Website is provided “as is,” with no warranty as to accuracy or content.
CrossDB does not adopt or endorse the views of any third party Websites linked to or from the CrossDB Website.
CrossDB reserves the right to change, modify, add or remove any of these terms at any time.
\ No newline at end of file
diff --git a/admin/data-backup/index.html b/admin/data-backup/index.html
index 75491e2..cd0a47f 100755
--- a/admin/data-backup/index.html
+++ b/admin/data-backup/index.html
@@ -1,4 +1,4 @@
- Data Backup - CrossDB
In order to keep CrossDB quality and high-performance, this project does not accept patches. If you would like to suggest a change and you include a patch as a proof-of-concept, that would be great. However, please do not be offended if we rewrite your patch from scratch.
Following contributions are welcome:
Language bindings: Python, Java, Go, CSharp, Javascript, PHP, etc
In order to keep CrossDB quality and high-performance, this project does not accept patches. If you would like to suggest a change and you include a patch as a proof-of-concept, that would be great. However, please do not be offended if we rewrite your patch from scratch.
Following contributions are welcome:
Language bindings: Python, Java, Go, CSharp, Javascript, PHP, etc
INSERTINTOstudent(id,name,age,class,score)VALUES(1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);
-INSERTINTOstudent(id,name,age,class,score,info)VALUES(6,'Tony',10,'3-1',95,'%s')",'He is a boy.\nHe likes playing football.\nWe all like him!');
+ Data Manipulation - CrossDB
INSERTINTOstudent(id,name,age,class,score)VALUES(1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);
+
+INSERTINTOstudent(id,name,age,class,score,info)VALUES(6,'Tony',10,'3-1',95,'%s')",'He is a boy.\nHe likes playing football.\nWe all like him!');
pRes=xdb_exec(pConn,"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)");
-pRes=xdb_pexec(pConn,"INSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')","He is a boy.\nHe likes playing football.\nWe all like him!");
-
Multi-Statements feature can improve performance a lot especailly for client-server mode. As you can run a batch of statements in one query, then get result one by one in parallel. For database doesn't support Multi-Statements, you have to send one statement, wait result, then send next one which will be low performance especailly when network lattency is big.
xdb_stmt_t*pStmt=xdb_stmt_prepare(pConn,"SELECT * FROM student WHERE id=?");
+if(NULL!=pStmt){
+xdb_bind_int(pStmt,1,id);
+pRes=xdb_stmt_exec(pStmt);
+pRow=xdb_fetch_row(pRes);
+// handle pRow
+xdb_free_result(pRes);
+
+// close when finish using
+xdb_stmt_close(pStmt);
+}
+}
+
xdb_stmt_t*pStmt=xdb_stmt_prepare(pConn,"UPDATE student SET age=15 WHERE id=?");
+if(NULL!=pStmt){
+xdb_bind_int(pStmt,1,id);
+pRes=xdb_stmt_exec(pStmt);
+
+// close when finish using
+xdb_stmt_close(pStmt);
+}
+}
+
xdb_stmt_t*pStmt=xdb_stmt_prepare(pConn,"DELETE FROM student WHERE id=?");
+if(NULL!=pStmt){
+xdb_bind_int(pStmt,1,id[i]);
+pRes=xdb_stmt_exec(pStmt);
+
+// close when finish using
+xdb_stmt_close(pStmt);
+}
+}
+
xdb_res_t*pRes=xdb_exec(pConn,"SELECT id,name,age,class,score from student WHERE id = 2");
+
+xdb_res_t*pRes=xdb_pexec(pConn,"SELECT id,name,age,class,score from student WHERE id = %d",id);
+
+// check pRes->errcode = 0
+
printf("char value %d\n",*(char*)pRow[0]);
+printf("short value %d\n",*(short*)pRow[1]);
+printf("int value %d\n",*(int*)pRow[2]);
+printf("bigint value %"PRIi64"\n",*(int64_t*)pRow[3]);
+printf("float value %f\n",*(float*)pRow[4]);
+printf("double value %d\n",*(double*)pRow[5]);
+printf("string value %s\n",*(char*)pRow[6]);
+printf("string len %d\n",*(uint16_t*)(pRow[6]-2));
+
Access by API
printf("char value %d\n",xdb_column_int(pRes->col_meta,pRow,0));
+printf("short value %d\n",xdb_column_int(pRes->col_meta,pRow,1));
+printf("int value %d\n",xdb_column_int(pRes->col_meta,pRow,2));
+printf("bigint value %"PRIi64"\n",xdb_column_int64(pRes->col_meta,pRow,3));
+printf("float value %f\n",xdb_column_float(pRes->col_meta,pRow,4));
+printf("double value %d\n",xdb_column_double(pRes->col_meta,pRow,5));
+printf("string value %s\n",xdb_column_str(pRes->col_meta,pRow,6));
+intlen;
+printf("string value %s, len %d\n",xdb_column_str2(pRes->col_meta,pRow,6,&len),len);
+
Current CrossDB uses table-level readwrite lock, only one writer connection thread can modify the table, other writer connection threads will be blocked. However the reader connection threads won't be blocked and they'll see the old values. When the writer connection change is committed, the new value is visible by these reader connections (read committed). In short writer before commit will not block readers to read old values
Current CrossDB uses table-level readwrite lock, only one writer connection thread can modify the table, other writer connection threads will be blocked. However the reader connection threads won't be blocked and they'll see the old values. When the writer connection change is committed, the new value is visible by these reader connections (read committed). In short writer before commit will not block readers to read old values
pRes=xdb_exec(pConn,"CREATE TABLE student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(255))");XDB_CHECK(pRes,printf("Can't create table student\n");gotoerror;);pRes=xdb_exec(pConn,"CREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(255), INDEX (name))");XDB_CHECK(pRes,printf("Can't create table teacher\n");gotoerror;);pRes=xdb_exec(pConn,"CREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name))");XDB_CHECK(pRes,printf("Can't create table book\n");gotoerror;);
-
Insert Rows
pRes=xdb_exec(pConn,"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)");
+
pRes=xdb_exec(pConn,"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)");XDB_CHECK(pRes,printf("Can't insert table student\n");gotoerror;);pRes=xdb_pexec(pConn,"INSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')","He is a boy.\nHe likes playing football.\nWe all like him!");XDB_CHECK(pRes,printf("Can't insert table student\n");gotoerror;);
@@ -28,26 +18,14 @@
XDB_CHECK(pRes,printf("Can't insert table teacher\n");gotoerror;);pRes=xdb_exec(pConn,"INSERT INTO book (id,name,author,count) VALUES (1,'Romeo and Juliet','Shakespeare',10),(2,'Pride and Prejudice','Austen',5),(3,'Great Expectations','Dickens',8),(4,'Sorrows of Young Werther','Von Goethe',4)");XDB_CHECK(pRes,printf("Can't insert table book\n");gotoerror;);
-
printf("\n=== Update age = 9 for id = 2\n");pRes=xdb_exec(pConn,"UPDATE student set age=9 WHERE id = 2");XDB_CHECK(pRes,printf("Can't update id=%d\n",2);gotoerror;);
@@ -58,7 +36,7 @@
printf("\n");}xdb_free_result(pRes);
-
printf("\n=== Delete id = 3\n");pRes=xdb_exec(pConn,"DELETE FROM student WHERE id = 3");XDB_CHECK(pRes,printf("Can't delete id=%d\n",3);gotoerror;);
@@ -69,27 +47,15 @@
printf("\n");}xdb_free_result(pRes);
-
printf("\n=== Rollback\n");xdb_begin(pConn);pRes=xdb_exec(pConn,"UPDATE student set age=15 WHERE id = 2");pRes=xdb_exec(pConn,"SELECT id,name,age from student WHERE id = 2");
@@ -108,7 +74,7 @@
printf("\n");}xdb_free_result(pRes);
-
printf("\n=== Commit\n");xdb_begin(pConn);pRes=xdb_exec(pConn,"UPDATE student set age=15 WHERE id = 2");pRes=xdb_exec(pConn,"SELECT * from student WHERE id = 2");
@@ -127,7 +93,7 @@
printf("\n");}xdb_free_result(pRes);
-
ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Each of these properties is described below.
Atomicity means that either all the changes of an operation are performed, or none of them are.
Consistency means that transactions always bring the database from one consistent state to another.
Isolation means that a transaction in process is invisible to other transactions until it completes. This allows concurrent transactions to read and write data without sacrificing consistency.
Durability means that once a transaction is committed, it remains committed even in the event of a system failure.
Acronym for “create, read, update, delete”, a common sequence of operations in database applications. Often denotes a class of applications with relatively simple database usage (basic DDL, DML and query statements in SQL) that can be implemented quickly in any language.
Data definition language, a set of SQL statements for manipulating the database itself rather than individual table rows. Includes all forms of the CREATE, ALTER, and DROP statements. DDL statements automatically commit the current transaction; they cannot be rolled back.
IMDB(In-Memory database) is a type of database system that maintains data in memory, to avoid overhead due to disk I/O and translation between disk blocks and memory areas.
A data structure that provides a fast lookup capability for rows of a table, typically by forming a tree structure (B-tree) representing all the values of a particular column or set of columns.
The name of the database that provides a query interface to the CrpssDB data dictionary. (This name is defined by the ANSI SQL standard.) To examine information (metadata) about the database, you can query tables such as INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS, rather than using SHOW commands that produce unstructured output.
MVCC(Multi-Version Concurrency Control) is a concurrency control mechanism in many databases. It processes the memory read by transactions to achieve concurrent access to DB, thereby avoiding blocking caused by conflicts between concurrent reads and writes.
Acronym for “Online Transaction Processing”. A database system, or a database application, that runs a workload with many transactions, with frequent writes as well as reads, typically affecting small amounts of data at a time.
ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Each of these properties is described below.
Atomicity means that either all the changes of an operation are performed, or none of them are.
Consistency means that transactions always bring the database from one consistent state to another.
Isolation means that a transaction in process is invisible to other transactions until it completes. This allows concurrent transactions to read and write data without sacrificing consistency.
Durability means that once a transaction is committed, it remains committed even in the event of a system failure.
Acronym for “create, read, update, delete”, a common sequence of operations in database applications. Often denotes a class of applications with relatively simple database usage (basic DDL, DML and query statements in SQL) that can be implemented quickly in any language.
Data definition language, a set of SQL statements for manipulating the database itself rather than individual table rows. Includes all forms of the CREATE, ALTER, and DROP statements. DDL statements automatically commit the current transaction; they cannot be rolled back.
IMDB(In-Memory database) is a type of database system that maintains data in memory, to avoid overhead due to disk I/O and translation between disk blocks and memory areas.
A data structure that provides a fast lookup capability for rows of a table, typically by forming a tree structure (B-tree) representing all the values of a particular column or set of columns.
The name of the database that provides a query interface to the CrpssDB data dictionary. (This name is defined by the ANSI SQL standard.) To examine information (metadata) about the database, you can query tables such as INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS, rather than using SHOW commands that produce unstructured output.
MVCC(Multi-Version Concurrency Control) is a concurrency control mechanism in many databases. It processes the memory read by transactions to achieve concurrent access to DB, thereby avoiding blocking caused by conflicts between concurrent reads and writes.
Acronym for “Online Transaction Processing”. A database system, or a database application, that runs a workload with many transactions, with frequent writes as well as reads, typically affecting small amounts of data at a time.
CrossDB is easy to install and deploy. It has zero external dependencies and runs in-process in its host application or as a single binary with tiny footprint.
\ No newline at end of file
diff --git a/search/search_index.json b/search/search_index.json
index cd5cbb8..7d1f138 100755
--- a/search/search_index.json
+++ b/search/search_index.json
@@ -1 +1 @@
-{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":"
CrossDBSuper High-performance Embedded and Server RDBMS\u2728
Quick Learn\ud83e\udded Benchmark \ud83d\udcdc
\ud83c\udf0c Simple
CrossDB is easy to install and deploy. It has zero external dependencies and runs in-process in its host application or as a single binary with tiny footprint.
\u267b\ufe0f Portable
CrossDB runs on Linux, macOS, Windows, BSD and all popular hardware architectures. It has idiomatic client APIs for major programming languages.
Read more
\ud83d\ude80 Super Fast
The hand-writing SQL parser and memory-oriented design architecture make the database run SQL at blazing speed.
\u26fd Hybrid Storage Mode
CrossDB supports On-Disk database and In-Memory database(IMDB). It can also support Hybrid mode with some tables On-Disk and some In-Memory.
\ud83d\udd31 MySQL-like SQL
Most SQL commands are similar with MySQL.
Read more
\ud83d\udcae Server Mode
Besides the Embedded RDBMS mode, CrossDB can also run in Embedded Server mode or run CrossDB as Standalone RDBMS server.
CSQL
xdb_res_t *pRes;\nxdb_row_t *pRow;\nxdb_conn_t *pConn = xdb_open (\":memory:\");\npRes = xdb_exec (pConn, \"CREATE TABLE student (id INT, name CHAR(16), age INT, class CHAR(16), score INT)\");\npRes = xdb_exec (pConn, \"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)\");\npRes = xdb_exec (pConn, \"SELECT * from student\");\nwhile (NULL != (pRow = xdb_fetch_row (pRes))) {\n xdb_print_row (pRes->row_meta, pRow);\n printf (\"\\n\");\n}\nxdb_free_result (pRes);\npRes = xdb_exec (pConn, \"UPDATE student set age=9 WHERE id = 2\");\npRes = xdb_exec (pConn, \"DELETE FROM student WHERE id = 3\");\nxdb_close (pConn);\n
CREATE TABLE student (id INT, name CHAR(16), age INT, class CHAR(16), score INT);\nINSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);\nSELECT * FROM student;\nSELECT * FROM student WHERE id = 1;\nUPDATE student set age=9 WHERE id = 2;\nDELETE FROM student WHERE id = 3;\n
Note
This project was redesigned and rewritten from scratch. It's still in early development stage, so please DO NOT use in your project now.
In order to keep CrossDB quality and high-performance, this project does not accept patches. If you would like to suggest a change and you include a patch as a proof-of-concept, that would be great. However, please do not be offended if we rewrite your patch from scratch.
Following contributions are welcome:
Language bindings: Python, Java, Go, CSharp, Javascript, PHP, etc
Test and report bugs
"},{"location":"faq/","title":"FAQ","text":""},{"location":"faq/#why-is-crossdb-so-fast","title":"Why is CrossDB so fast?","text":"
Use memory map to access DB data directly (so your DB must less than the main memory to get highest speed).
Use high-performance hash as the main index, and use the super fast wyhash as the hash function.
Hand-written SQL parser which is more than 10X faster than Flex/Bison parser tools.
High-performance read-write lock and multi-core optimization.
Execute multiple SQL statements in one API, which will imporve client-server DB performance dramatically.
ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Each of these properties is described below.
Atomicity means that either all the changes of an operation are performed, or none of them are.
Consistency means that transactions always bring the database from one consistent state to another.
Isolation means that a transaction in process is invisible to other transactions until it completes. This allows concurrent transactions to read and write data without sacrificing consistency.
Durability means that once a transaction is committed, it remains committed even in the event of a system failure.
Acronym for \u201ccreate, read, update, delete\u201d, a common sequence of operations in database applications. Often denotes a class of applications with relatively simple database usage (basic DDL, DML and query statements in SQL) that can be implemented quickly in any language.
Data definition language, a set of SQL statements for manipulating the database itself rather than individual table rows. Includes all forms of the CREATE, ALTER, and DROP statements. DDL statements automatically commit the current transaction; they cannot be rolled back.
IMDB(In-Memory database) is a type of database system that maintains data in memory, to avoid overhead due to disk I/O and translation between disk blocks and memory areas.
A data structure that provides a fast lookup capability for rows of a table, typically by forming a tree structure (B-tree) representing all the values of a particular column or set of columns.
The name of the database that provides a query interface to the CrpssDB data dictionary. (This name is defined by the ANSI SQL standard.) To examine information (metadata) about the database, you can query tables such as INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS, rather than using SHOW commands that produce unstructured output.
MVCC(Multi-Version Concurrency Control) is a concurrency control mechanism in many databases. It processes the memory read by transactions to achieve concurrent access to DB, thereby avoiding blocking caused by conflicts between concurrent reads and writes.
Acronym for \u201cOnline Transaction Processing\u201d. A database system, or a database application, that runs a workload with many transactions, with frequent writes as well as reads, typically affecting small amounts of data at a time.
You can use CrossDB In-Memory DB to manage Process Runtime Data to replace STL or hand-wrting data structures.
You can use CrossDB RamDisk DB to support Process Restartability, In-Service Software Upgrade(ISSU) easily.
You can use CrossDB OnDisk DB to store data on Disk/Flash/SDD.
You can use CrossDB to work as a super fast cache DB.
"},{"location":"about/buy/","title":"How to Buy","text":""},{"location":"about/privacy/","title":"Privacy Notice","text":""},{"location":"about/privacy/#introduction","title":"Introduction","text":"
CrossDB Software has designed its website so that, in general, you can browse the CrossDB website without being asked for any personal information. Exceptions to this are when you specifically ask for information, request an evaluation copy of our software or download CrossDB trial software.
This policy covers how CrossDB Software treats personal information that CrossDB may collect and receive via the CrossDB website. Your use of the CrossDB website constitutes acceptance of and agreement with the CrossDB Software Privacy Policy. CrossDB reserves the right to change the CrossDB Software Privacy Policy at any time without notice.
"},{"location":"about/privacy/#information-collection-and-use","title":"Information collection and use","text":"
CrossDB collects personal information when you request for information, request an evaluation of our software or when you download trial software. This information includes information about you such as name, business name and address, telephone and fax numbers, email address, operating system, and hardware environment. Providing information is voluntary. You may provide this information by filling out an on-line form, by email or other communication to CrossDB. However, you may not receive the product information, software evaluation or downloads if you choose not to provide the requested information.
CrossDB Software's use of the information you provided will be to send you the information that you requested. CrossDB Software may also use the information to provide you with additional information about our products and services or market research. The information may be used to follow up with you regarding information supplied, software you downloaded or evaluated.
CrossDB does not sell information collected from users of CrossDB website to other organizations. CrossDB may share the information collected with its subsidiaries and its affiliates such as partners and distributors.
CrossDB web servers record standard information about CrossDB Web accesses such as IP addresses, your server name, browser type, etc. when you visit our website. CrossDB uses this for information about usage at CrossDB Software's website. The information submitted to CrossDB Software via the Web may be processed, stored and used outside the country where it was submitted.
Links to third party websites are provided for your convenience. By using these links, you will no longer be on the CrossDB Software website and the CrossDB Software Privacy Policy will no longer apply.
If you have any question about the information you provided to us or about the CrossDB Software Privacy Policy, please contact us at support@crossdb.org
Thank you for using CrossDB Database! We don't offer refund, please try it first then subscribe the product by month or year. You can cancel the subscription anytime as you want.
"},{"location":"about/terms/","title":"Terms of Service","text":"
CrossDB provides this Website for your information and use, subject to the terms set forth below. By accessing this Website, you agree to accept the following terms.
In no event will CrossDB be liable for any damages including, without limitation, indirect, incidental, consequential, special or exemplary damages, that arise out of or relate to the use of or inability to use the CrossDB Website, even if CrossDB has been advised of the possibility of such damages.
Any and all information provided on CrossDB\u2019s Website is provided \u201cas is,\u201d with no warranty as to accuracy or content.
CrossDB does not adopt or endorse the views of any third party Websites linked to or from the CrossDB Website.
CrossDB reserves the right to change, modify, add or remove any of these terms at any time.
"},{"location":"admin/data-backup/","title":"Data Backup","text":""},{"location":"admin/data-backup/#dump-with-dump-statement","title":"Dump with DUMP statement","text":"
Dump everything
SQLC
DUMP DATABASE school INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school INTO 'school.sql'\");\n
Dump schema only
SQLC
DUMP DATABASE school NODATA INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school NODATA INTO 'school.sql'\");\n
Dump data only
SQLC
DUMP DATABASE school NODROP NOCREATE INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school NODROP NOCREATE INTO 'school.sql'\");\n
"},{"location":"admin/data-backup/#dump-with-crossdb-tool","title":"Dump with crossdb tool","text":"
Dump everything
crossdb -e \"DUMP DATABASE\" school > school.sql\n
crossdb -e \"DUMP DATABASE school INTO 'school.sql'\" school\n
Dump schema only
crossdb -e \"DUMP DATABASE school NODATA INTO 'school.sql'\" school\n
Dump data only
crossdb -e \"DUMP DATABASE school NODROP NOCREATE INTO 'school.sql'\" school\n
"},{"location":"admin/data-restore/","title":"Data Restore","text":""},{"location":"admin/data-restore/#load-with-source-statement","title":"Load with SOURCE statement","text":"SQLC
SOURCE 'school.sql'\n
xdb_exec (pConn, \"SOURCE 'school.sql'\");\n
"},{"location":"admin/data-restore/#load-with-crossdb-tool","title":"Load with CrossDB tool","text":"
$ crossdb -h\ncrossdb: option requires an argument -- 'h'\nUsage: xdb-cli [OPTIONS] [[path/]db_name]\n -h Show this help\n -S Server: Start in server mode\n -h <ip> IP address to bind to or connect to\n -P <port> Port to listen or connect\n -D <datadir> Server: Data directory to store databases\n -u <user> Client user\n -p Client password\n -e <sql> Execute SQL statements and quite\n
Use TAB to do auto completion for SQL statements, keywords, db name, table name, field name, etc.
XDB> <TAB>\nCREATE Create database, table, index, etc\nDROP Drop database, table, index, etc\nALTER Alter database, table, index, etc\nSELECT Select rows from table\nINSERT Insert rows into table\nUPDATE Update rows in table\nDELETE Delete rows from table\nBEGIN Begin transaction\nCOMMIT Commit transaction\nROLLBACK Rollback transaction\nUSE Switch Databae\nSHOW Show database, table, index, etc\nDESCRIBE Show Table Schema\nEXPLAIN Show SELECT statement index selection\nSET Config parameters\nOPEN Open database\nCLOSE Close database\nDUMP Dump database\nSOURCE Load SQL file\nSHELL Enter interactive shell\nHELP Help\n
XDB> S <TAB>\nSELECT Select rows from table\nSHOW Show database, table, index, etc\nSET Config parameters\nSOURCE Load SQL file\nSHELL Enter interactive shell\nXDB> SE <TAB>\nSELECT Select rows from table\nSET Config parameters\nXDB> SEL <TAB>\nXDB> SELECT\n
XDB> SELECT <TAB>\nXDB> SELECT * <TAB>\nXDB> SELECT * FROM <TAB>\nstudent teacher book\nXDB> SELECT * FROM s<TAB>\nXDB> SELECT * FROM student\n
XDB> SELECT * FROM student <TAB>\nWHERE ORDER BY LIMIT OFFSET AND id name age class score\ninfo\nXDB> SELECT * FROM student WHERE i <TAB>\nid info\n
XDB> SHOW <TAB>\nDATABASES TABLES INDEXES COLUMNS CREATE\n
"},{"location":"client/api-c/","title":"C APIs","text":""},{"location":"client/api-c/#apis-list","title":"APIs List","text":"API Descritpion xdb_conn_t* xdb_open (const char *path) Open a connection void xdb_close (xdb_conn_t *pConn) Close a connection xdb_res_t* xdb_exec (xdb_conn_t* pConn, const char *sql) Execute SQL statement xdb_res_t* xdb_pexec (xdb_conn_t* pConn, const char *sql, ...) Execute formatted SQL statement xdb_res_t* xdb_next_result (xdb_conn_t *pConn) Get next SQL statement result bool xdb_more_result (xdb_conn_t* pRes) Check is there more result void xdb_free_result (xdb_res_t* pRes) Free result set xdb_col_t* xdb_column_meta (uint64_t meta, uint16_t iCol) Fetch one row xdb_row_t* xdb_fetch_row (xdb_res_t* pRes) Fetch one row int xdb_column_int (uint64_t meta, void *pRow, uint16_t iCol) Get int column from row float xdb_column_float (uint64_t meta, void *pRow, uint16_t iCol) Get float/double column from row const char * xdb_column_str (uint64_t meta, void *pRow, uint16_t iCol) Get string column from row xdb_stmt_t* xdb_stmt_prepare (xdb_conn_t* pConn, const char *sql) Prepare statement xdb_ret xdb_bind_int (xdb_stmt_t *pStmt, uint16_t para_id, int val) Bind int value xdb_ret xdb_bind_float (xdb_stmt_t *pStmt, uint16_t para_id, float val) Bind float value xdb_ret xdb_bind_str (xdb_stmt_t *pStmt, uint16_t para_id, const char *str) Bind string value xdb_res_t* xdb_stmt_exec (xdb_stmt_t *pStmt) Execute prepared SQL statement void xdb_stmt_close (xdb_stmt_t *pStmt) Free prepared SQL statement xdb_ret xdb_begin (xdb_conn_t* pConn) Begin transaction xdb_ret xdb_commit (xdb_conn_t* pConn) Commit transaction xdb_ret xdb_rollback (xdb_conn_t* pConn) Rollback transaction int xdb_print_row (uint64_t meta, void *pRow, int format) Print row to console const char * xdb_errmsg (xdb_res_t *pRes) Get error/information message const char * xdb_version () Get CrossDB version string"},{"location":"client/api-c/#xdb_open","title":"xdb_open","text":"
If path is :memory: will create or open a memory database, else create or open a on-disk database. This database will be the default DB of this connection.
If path is NULL: Only open a connection. User has to use OPEN DATABASE '[path/]db_name' or CREATE DATABASE '[path/]db_name' or USE DATABASE db_name.
One thread can use only one connection. One connection can only be used by one thread
All opened databases are shared with all opened connections, and they can USE DATABASE db_name to switch connection default DB.
If you know the detailed format, you can access the pointer directly. *(int8_t*)pVal[iCol], *(int16_t*)pVal[iCol], *(int32_t*)pVal[iCol], *(int64_t*)pVal[iCol]
User has to use OPEN DATABASE '[path/]db_name' or CREATE DATABASE '[path/]db_name' or USE DATABASE db_name.
Open a connection and create a default memory database if not exist
xdb_conn_t *pConn = xdb_open (\":memory:\");\n
Open a connection and create a on-disk database school if not exist in current folder as the default database
xdb_conn_t *pConn = xdb_open (\"school\");\n
"},{"location":"develop/ddl/","title":"Data Model","text":""},{"location":"develop/ddl/#create-and-use-a-database","title":"Create and Use a Database","text":"SQLC
-- Create database in current folder\nCREATE DATABASE school;\n-- Create database in specified folder (must exist)\nCREATE DATABASE '/var/dbpath/school';\n-- Create in-memory database \nCREATE DATABASE test ENGINE=memory;\n
// Create database in current folder\nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE school\");\n// Create database in specified folder (must exist)\nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE '/var/dbpath/school'\");\n// Create in-memory database \nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE test ENGINE=memory\");\n
"},{"location":"develop/ddl/#create-a-table","title":"Create a Table","text":"SQLC
CREATE TABLE IF NOT EXISTS student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(256), INDEX (name));\nCREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(256), INDEX (name));\nCREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name));\n
xdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(256), INDEX (name))\");\nxdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(256), INDEX (name))\");\nxdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name))\");\n
INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);\nINSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')\", 'He is a boy.\\nHe likes playing football.\\nWe all like him!');\n
pRes = xdb_exec (pConn, \"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)\");\npRes = xdb_pexec (pConn, \"INSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')\", \"He is a boy.\\nHe likes playing football.\\nWe all like him!\");\n
Current CrossDB uses table-level readwrite lock, only one writer connection thread can modify the table, other writer connection threads will be blocked. However the reader connection threads won't be blocked and they'll see the old values. When the writer connection change is committed, the new value is visible by these reader connections (read committed). In short writer before commit will not block readers to read old values
crossdb/bench/c$ ./a.out 1000\n********************** INSERT 1000 with SQL **********************\nUse time 763ns, QPS 1310615\n********************** Random LKUP 5000000 with SQL **********************\nUse time 951987ns, QPS 5252172\nUse time 921033ns, QPS 5428687\nUse time 915605ns, QPS 5460870\nUse time 926288ns, QPS 5397889\n********************** UPDATE 1000 with SQL **********************\nUse time 760ns, QPS 1315789\n********************** DELETE 1000 with SQL **********************\nUse time 438ns, QPS 2283105\n\n********************** INSERT 1000 with SQL **********************\nUse time 687ns, QPS 1455604\n********************** Random LKUP 10000000 with Prepared STMT **********************\nUse time 294717ns, QPS 33930855\nUse time 297268ns, QPS 33639678\nUse time 298728ns, QPS 33475268\nUse time 295278ns, QPS 33866390\n********************** UPDATE 1000 with Prepared SMTT **********************\nUse time 576ns, QPS 1736111\n********************** DELETE 1000 with Prepared SQL **********************\nUse time 252ns, QPS 3968253\n
Test with 1000,1000 rows
crossdb$ make bench\nor\ncrossdb/bench/c$ ./a.out\n\n********************** INSERT 1000000 with SQL **********************\nUse time 539342ns, QPS 1854111\n********************** Random LKUP 1000000 with SQL **********************\nUse time 336044ns, QPS 2975800\nUse time 333927ns, QPS 2994666\nUse time 329699ns, QPS 3033069\nUse time 331632ns, QPS 3015390\n********************** UPDATE 1000000 with SQL **********************\nUse time 579945ns, QPS 1724301\n********************** DELETE 1000000 with SQL **********************\nUse time 405004ns, QPS 2469111\n\n********************** INSERT 1000000 with SQL **********************\nUse time 527486ns, QPS 1895784\n********************** Random LKUP 10000000 with Prepared STMT **********************\nUse time 1678936ns, QPS 5956153\nUse time 1668971ns, QPS 5991715\nUse time 1670993ns, QPS 5984465\nUse time 1652815ns, QPS 6050283\n********************** UPDATE 1000000 with Prepared SMTT **********************\nUse time 381320ns, QPS 2622469\n********************** DELETE 1000000 with Prepared SQL **********************\nUse time 232181ns, QPS 4306984\n
"},{"location":"get-started/install/","title":"Build and Install","text":""},{"location":"get-started/install/#build","title":"Build","text":"
crossdb$ make\nmake build Build crossdb library and tool\nmake debug Build crossdb library and tool with debug\nmake run Run crossdb tool\nmake clean Clean build result\nmake install Install crossdb(lib&tool&header) to Linux & FreeBSD\nmake uninstall Uninstall crossdb from Linux & FreeBSD\nmake installmacos Install crossdb(lib&tool&header) to MacOS\nmake uninstallmacos Uninstall crossdb from MacOS\nmake example Build and run example (need to install crossdb first)\nmake bench Build and run bench test (need to install crossdb first)\n
pRes = xdb_exec (pConn, \"CREATE TABLE student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(255))\");\nXDB_CHECK(pRes, printf (\"Can't create table student\\n\"); goto error;);\npRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(255), INDEX (name))\");\nXDB_CHECK(pRes, printf (\"Can't create table teacher\\n\"); goto error;);\npRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name))\");\nXDB_CHECK(pRes, printf (\"Can't create table book\\n\"); goto error;);\n
Insert Rows
pRes = xdb_exec (pConn, \"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)\");\nXDB_CHECK(pRes, printf (\"Can't insert table student\\n\"); goto error;);\npRes = xdb_pexec (pConn, \"INSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')\", \"He is a boy.\\nHe likes playing football.\\nWe all like him!\");\nXDB_CHECK(pRes, printf (\"Can't insert table student\\n\"); goto error;);\npRes = xdb_pexec (pConn, \"INSERT INTO student (id,name,age,class,score,info) VALUES (7,'Wendy',10,'3-1',95,'%s')\", \"She is a girl.\\nShe likes cooking.\\nWe all love her!\");\nXDB_CHECK(pRes, printf (\"Can't insert table student\\n\"); goto error;);\npRes = xdb_exec (pConn, \"INSERT INTO teacher (id,name,age) VALUES (1,'Tomas',40),(2,'Steven',50),(3,'Bill',31),(4,'Lucy',29)\");\nXDB_CHECK(pRes, printf (\"Can't insert table teacher\\n\"); goto error;);\npRes = xdb_exec (pConn, \"INSERT INTO book (id,name,author,count) VALUES (1,'Romeo and Juliet','Shakespeare',10),(2,'Pride and Prejudice','Austen',5),(3,'Great Expectations','Dickens',8),(4,'Sorrows of Young Werther','Von Goethe',4)\");\nXDB_CHECK(pRes, printf (\"Can't insert table book\\n\"); goto error;);\n
SHOW REPLICSTATUS\n show secondary status\n\nSHOW REPLICATION\n show my replica status\n\nrole: master/slave\n\nSHOW MASTER STATUS\n\nSHOW REPLICA STATUS [FOR CHANNEL channel]\nSHOW SLAVE STATUS [FOR CHANNEL channel]\n
DUMP DATABASE db_name [dump_option] ...\n\ndump_option:\n NODROP : Don't add DROP statement\n | NOCREATE : Don't add CREATE statement\n | NODATA : Don't dump ROW data\n | INTO '[path/]outfile' : Dump into file instead of console\n
"},{"location":"sql/data-types/","title":"Data Types","text":"Type Bytes Description Note BOOL 1 Bool, the value range is {true, false}. TBD TINYINT 1 Single-byte integer, the value range is [-128, 127]. SMALLINT 2 Short integer, the value range is [-32768, 32767]. INT 4 Integer, the value range is [-2^31, 2^31-1]. BIGINT 8 Long integer, the value range is [-2^63, 2^63-1]. TINYINT UNSIGNED 1 unsigned single-byte integer, the value range is [0, 255]. TBD SMALLINT UNSIGNED 2 unsigned integer, the value range is [0, 65535]. TBD INT UNSIGNED 4 Unsigned integer, the value range is [0, 2^32-1]. TBD BIGINT UNSIGNED 8 unsigned long integer, the value range is [0, 2^64-1]. TBD TIMESTAMP 8 Default precision is microsecond. TBD FLOAT 4 Floating point number. DOUBLE 8 Double precision floating point number. CHAR [COLLATE collation_name] User-defined, max 65535 Fixed-length UTF-8 string. VARCHAR [COLLATE collation_name] User-defined, max 65535 Variable-Length UTF-8 string. TBD BINARY User-defined, max 65535 Fixed-length binary data. TBD VARBINARY User-defined, max 65535 Variable-Length binary data. TBD"},{"location":"sql/data-types/#collation","title":"Collation","text":"Type Description NOCASE Case insensitive [Default]. BINARY Case sensitive."},{"location":"sql/data-types/#escape-characters","title":"Escape Characters","text":"Escape Character Actual Meaning \\n Line Break \\r Carriage Return \\t tab \\' Single quote ' \\\" Double quote \" ` backtick ` \\ Back Slash \\ \\% % see below for details _ _ see below for details"},{"location":"sql/database/","title":"Database","text":""},{"location":"sql/database/#create-database","title":"Create Database","text":"
LOCKMODE Lock used Description THREAD [default] high-performance thread read-write lock For single process multiple threads access. PROCESS file read-write lock For multiple processes multiple threads access. NOLOCK no lock For test/diag purpose only.
Note
'[path]/db_name' is only valid for embedded database. db_options are default values for new created tables and you can use table_options to overwrite these default values.
"},{"location":"sql/functions/","title":"Functions","text":""},{"location":"sql/functions/#aggregate-functions","title":"Aggregate Functions","text":"Function Return Type Description COUNT(*) BIGINT The number of rows. COUNT(col_name) BIGINT The number of rows in the specified column. MIN(col_name) Same with column The minimum value of a specific column MAX(col_name) Same with column The maximum value of a specific column. SUM(col_name) DOUBLE or BIGINT The sum of a specific column in a table AVG(col_name) DOUBLE The average value of the specified column."},{"location":"sql/indexes/","title":"Index","text":""},{"location":"sql/indexes/#create-index","title":"Create Index","text":"
CREATE [UNIQUE] INDEX idx_name \n [USING {HASH | BTREE}] \n ON tbl_name (col_name,...)\n
"},{"location":"sql/name-limit/","title":"Name and Limit","text":""},{"location":"sql/name-limit/#case-sensitive","title":"Case Sensitive","text":"Type Case-sensitive Keyword False Function False DB Name False Table Name False Column Name False Index Name False"},{"location":"sql/name-limit/#limit","title":"Limit","text":"Type Limit DB Name 64 Table Name 64 Column Name 64 Index Name 64 Single SQL statement 1048576 (1M) DB per process 1024 Table per DB 4095 Rows per Table 2,000,000,000 (2B) Row size 524288 (512K) Index per Table 16 Filter Fields 64"},{"location":"sql/operators/","title":"Operators","text":""},{"location":"sql/operators/#comparison-operators","title":"Comparison Operators","text":"Operator Description Note = Equal to <>, != Not equal to TBD > Greater than TBD < Less than TBD >= Greater than or equal to TBD <= Less than or equal to TBD IS NULL NULL value test TBD IS NOT NULL NOT NULL value test TBD BETWEEN ... AND ... Whether a value is within a range of values TBD NOT BETWEEN ... AND ... Whether a value is not within a range of values TBD IN Whether a value is not within a set of values TBD NOT IN Negation of simple pattern matching TBD LIKE Wildcard match TBD
LIKE is used together with wildcards to match strings. Its usage is described as follows:
'%' matches 0 or any number of characters, '_' matches any single ASCII character.
\\_ is used to match the _ in the string.
"},{"location":"sql/operators/#logical-operators","title":"Logical Operators","text":"Operator Description Note AND Logical AND OR Logical OR TBD"},{"location":"sql/statements/","title":"SQL Statements","text":"Statement Descritpion Note BEGIN Start a new transaction. COMMIT Commits the open transaction if exists. CLOSE DATABASE Close an opened database. Embedded Mode only CREATE DATABASE Create a database. CREATE INDEX Create an index on the specified table. CREATE TABLE Create a new table. DELETE Delete rows in a table. DESCRIBE Describe the specified table. DROP DATABASE Drop a database. DROP INDEX Drop the specified index on the specified table. DROP TABLE Drop the specified table. DUMP DATABASE Dump database into file. EXPLAIN Returns detailed information on how the query is executed. HELP SQL statements help. INSERT Insert data into a table. OPEN DATABASE Open a database on disk. Embedded Mode only ROLLBACK Roll back the open transaction if exists. SELECT Retrieves data from a table. SET AUTOCOMMIT Set session transaction auto-commit. SHELL Enter interactive shell. SHOW COLUMNS Show the list of columns within a given table. SHOW CREATE TABLE Show the CREATE TABLE statement. SHOW DATABASE Show the list of databases. SHOW INDEXES Show the list of indexes associated with a given table. SHOW TABLES Show the list of tables in database. SOURCE Load and execute SQL file. UPDATE Modifies rows in a table. USE Use the database as the current default database."},{"location":"sql/table/","title":"Table","text":""},{"location":"sql/table/#create-table","title":"Create Table","text":"
XDB> DESCRIBE student ;\n+--------+-------+-----+\n| column | type | len |\n+--------+-------+-----+\n| id | INT | 4 |\n| name | CHAR | 16 |\n| age | INT | 4 |\n| class | CHAR | 16 |\n| score | FLOAT | 4 |\n| info | CHAR | 256 |\n+--------+-------+-----+\n6 rows in set (0.023 ms)\n
"},{"location":"sql/transaction/","title":"Transaction and Lock","text":""},{"location":"sql/transaction/#begin-transaction","title":"Begin Transaction","text":"
This command must be executed after BEGIN transaction for performance or prevent other sessions to , and locks will be released after commit transaction.
XDB> SELECT * FROM system.indexes where database='memory';\n+----------+---------+---------+------+----------+\n| database | table | idx_key | type | col_list |\n+----------+---------+---------+------+----------+\n| memory | student | PRIMARY | HASH | id |\n| memory | student | name_2 | HASH | name |\n| memory | teacher | PRIMARY | HASH | id |\n| memory | teacher | name_2 | HASH | name |\n| memory | book | PRIMARY | HASH | id |\n| memory | book | name_2 | HASH | name |\n+----------+---------+---------+------+----------+\n6 rows in set (0.016 ms)\n
"}]}
\ No newline at end of file
+{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Home","text":"
CrossDBSuper High-performance Embedded and Server RDBMS\u2728
Quick Learn\ud83e\udded Benchmark \ud83d\udcdc
\ud83c\udf0c Simple
CrossDB is easy to install and deploy. It has zero external dependencies and runs in-process in its host application or as a single binary with tiny footprint.
\u267b\ufe0f Portable
CrossDB runs on Linux, macOS, Windows, BSD and all popular hardware architectures. It has idiomatic client APIs for major programming languages.
Read more
\ud83d\ude80 Super Fast
The hand-writing SQL parser and memory-oriented design architecture make the database run SQL at blazing speed.
\u26fd Hybrid Storage Mode
CrossDB supports On-Disk database and In-Memory database(IMDB). It can also support Hybrid mode with some tables On-Disk and some In-Memory.
\ud83d\udd31 MySQL-like SQL
Most SQL commands are similar with MySQL.
Read more
\ud83d\udcae Server Mode
Besides the Embedded RDBMS mode, CrossDB can also run in Embedded Server mode or run CrossDB as Standalone RDBMS server.
CSQL
xdb_res_t *pRes;\nxdb_row_t *pRow;\nxdb_conn_t *pConn = xdb_open (\":memory:\");\npRes = xdb_exec (pConn, \"CREATE TABLE student (id INT, name CHAR(16), age INT, class CHAR(16), score INT)\");\npRes = xdb_exec (pConn, \"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)\");\npRes = xdb_exec (pConn, \"SELECT * from student\");\nwhile (NULL != (pRow = xdb_fetch_row (pRes))) {\n xdb_print_row (pRes->row_meta, pRow);\n printf (\"\\n\");\n}\nxdb_free_result (pRes);\npRes = xdb_exec (pConn, \"UPDATE student set age=9 WHERE id = 2\");\npRes = xdb_exec (pConn, \"DELETE FROM student WHERE id = 3\");\nxdb_close (pConn);\n
CREATE TABLE student (id INT, name CHAR(16), age INT, class CHAR(16), score INT);\nINSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);\nSELECT * FROM student;\nSELECT * FROM student WHERE id = 1;\nUPDATE student set age=9 WHERE id = 2;\nDELETE FROM student WHERE id = 3;\n
Note
This project was redesigned and rewritten from scratch. It's still in early development stage, so please DO NOT use in your project now.
In order to keep CrossDB quality and high-performance, this project does not accept patches. If you would like to suggest a change and you include a patch as a proof-of-concept, that would be great. However, please do not be offended if we rewrite your patch from scratch.
Following contributions are welcome:
Language bindings: Python, Java, Go, CSharp, Javascript, PHP, etc
Test and report bugs
"},{"location":"faq/","title":"FAQ","text":""},{"location":"faq/#why-is-crossdb-so-fast","title":"Why is CrossDB so fast?","text":"
Use memory map to access DB data directly (so your DB must less than the main memory to get highest speed).
Use high-performance hash as the main index, and use the super fast wyhash as the hash function.
Hand-written SQL parser which is more than 10X faster than Flex/Bison parser tools.
High-performance read-write lock and multi-core optimization.
Execute multiple SQL statements in one API, which will imporve client-server DB performance dramatically.
ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability. Each of these properties is described below.
Atomicity means that either all the changes of an operation are performed, or none of them are.
Consistency means that transactions always bring the database from one consistent state to another.
Isolation means that a transaction in process is invisible to other transactions until it completes. This allows concurrent transactions to read and write data without sacrificing consistency.
Durability means that once a transaction is committed, it remains committed even in the event of a system failure.
Acronym for \u201ccreate, read, update, delete\u201d, a common sequence of operations in database applications. Often denotes a class of applications with relatively simple database usage (basic DDL, DML and query statements in SQL) that can be implemented quickly in any language.
Data definition language, a set of SQL statements for manipulating the database itself rather than individual table rows. Includes all forms of the CREATE, ALTER, and DROP statements. DDL statements automatically commit the current transaction; they cannot be rolled back.
IMDB(In-Memory database) is a type of database system that maintains data in memory, to avoid overhead due to disk I/O and translation between disk blocks and memory areas.
A data structure that provides a fast lookup capability for rows of a table, typically by forming a tree structure (B-tree) representing all the values of a particular column or set of columns.
The name of the database that provides a query interface to the CrpssDB data dictionary. (This name is defined by the ANSI SQL standard.) To examine information (metadata) about the database, you can query tables such as INFORMATION_SCHEMA.TABLES and INFORMATION_SCHEMA.COLUMNS, rather than using SHOW commands that produce unstructured output.
MVCC(Multi-Version Concurrency Control) is a concurrency control mechanism in many databases. It processes the memory read by transactions to achieve concurrent access to DB, thereby avoiding blocking caused by conflicts between concurrent reads and writes.
Acronym for \u201cOnline Transaction Processing\u201d. A database system, or a database application, that runs a workload with many transactions, with frequent writes as well as reads, typically affecting small amounts of data at a time.
You can use CrossDB In-Memory DB to manage Process Runtime Data to replace STL or hand-wrting data structures.
You can use CrossDB RamDisk DB to support Process Restartability, In-Service Software Upgrade(ISSU) easily.
You can use CrossDB OnDisk DB to store data on Disk/Flash/SDD.
You can use CrossDB to work as a super fast cache DB.
"},{"location":"about/buy/","title":"How to Buy","text":""},{"location":"about/privacy/","title":"Privacy Notice","text":""},{"location":"about/privacy/#introduction","title":"Introduction","text":"
CrossDB Software has designed its website so that, in general, you can browse the CrossDB website without being asked for any personal information. Exceptions to this are when you specifically ask for information, request an evaluation copy of our software or download CrossDB trial software.
This policy covers how CrossDB Software treats personal information that CrossDB may collect and receive via the CrossDB website. Your use of the CrossDB website constitutes acceptance of and agreement with the CrossDB Software Privacy Policy. CrossDB reserves the right to change the CrossDB Software Privacy Policy at any time without notice.
"},{"location":"about/privacy/#information-collection-and-use","title":"Information collection and use","text":"
CrossDB collects personal information when you request for information, request an evaluation of our software or when you download trial software. This information includes information about you such as name, business name and address, telephone and fax numbers, email address, operating system, and hardware environment. Providing information is voluntary. You may provide this information by filling out an on-line form, by email or other communication to CrossDB. However, you may not receive the product information, software evaluation or downloads if you choose not to provide the requested information.
CrossDB Software's use of the information you provided will be to send you the information that you requested. CrossDB Software may also use the information to provide you with additional information about our products and services or market research. The information may be used to follow up with you regarding information supplied, software you downloaded or evaluated.
CrossDB does not sell information collected from users of CrossDB website to other organizations. CrossDB may share the information collected with its subsidiaries and its affiliates such as partners and distributors.
CrossDB web servers record standard information about CrossDB Web accesses such as IP addresses, your server name, browser type, etc. when you visit our website. CrossDB uses this for information about usage at CrossDB Software's website. The information submitted to CrossDB Software via the Web may be processed, stored and used outside the country where it was submitted.
Links to third party websites are provided for your convenience. By using these links, you will no longer be on the CrossDB Software website and the CrossDB Software Privacy Policy will no longer apply.
If you have any question about the information you provided to us or about the CrossDB Software Privacy Policy, please contact us at support@crossdb.org
Thank you for using CrossDB Database! We don't offer refund, please try it first then subscribe the product by month or year. You can cancel the subscription anytime as you want.
"},{"location":"about/terms/","title":"Terms of Service","text":"
CrossDB provides this Website for your information and use, subject to the terms set forth below. By accessing this Website, you agree to accept the following terms.
In no event will CrossDB be liable for any damages including, without limitation, indirect, incidental, consequential, special or exemplary damages, that arise out of or relate to the use of or inability to use the CrossDB Website, even if CrossDB has been advised of the possibility of such damages.
Any and all information provided on CrossDB\u2019s Website is provided \u201cas is,\u201d with no warranty as to accuracy or content.
CrossDB does not adopt or endorse the views of any third party Websites linked to or from the CrossDB Website.
CrossDB reserves the right to change, modify, add or remove any of these terms at any time.
"},{"location":"admin/data-backup/","title":"Data Backup","text":""},{"location":"admin/data-backup/#dump-with-dump-statement","title":"Dump with DUMP statement","text":"
Dump everything
SQLC
DUMP DATABASE school INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school INTO 'school.sql'\");\n
Dump schema only
SQLC
DUMP DATABASE school NODATA INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school NODATA INTO 'school.sql'\");\n
Dump data only
SQLC
DUMP DATABASE school NODROP NOCREATE INTO 'school.sql';\n
xdb_exec (pConn, \"DUMP DATABASE school NODROP NOCREATE INTO 'school.sql'\");\n
"},{"location":"admin/data-backup/#dump-with-crossdb-tool","title":"Dump with crossdb tool","text":"
Dump everything
crossdb -e \"DUMP DATABASE\" school > school.sql\n
crossdb -e \"DUMP DATABASE school INTO 'school.sql'\" school\n
Dump schema only
crossdb -e \"DUMP DATABASE school NODATA INTO 'school.sql'\" school\n
Dump data only
crossdb -e \"DUMP DATABASE school NODROP NOCREATE INTO 'school.sql'\" school\n
"},{"location":"admin/data-restore/","title":"Data Restore","text":""},{"location":"admin/data-restore/#load-with-source-statement","title":"Load with SOURCE statement","text":"SQLC
SOURCE 'school.sql'\n
xdb_exec (pConn, \"SOURCE 'school.sql'\");\n
"},{"location":"admin/data-restore/#load-with-crossdb-tool","title":"Load with CrossDB tool","text":"
$ crossdb -h\ncrossdb: option requires an argument -- 'h'\nUsage: xdb-cli [OPTIONS] [[path/]db_name]\n -h Show this help\n -S Server: Start in server mode\n -h <ip> IP address to bind to or connect to\n -P <port> Port to listen or connect\n -D <datadir> Server: Data directory to store databases\n -u <user> Client user\n -p Client password\n -e <sql> Execute SQL statements and quite\n
Use TAB to do auto completion for SQL statements, keywords, db name, table name, field name, etc.
XDB> <TAB>\nCREATE Create database, table, index, etc\nDROP Drop database, table, index, etc\nALTER Alter database, table, index, etc\nSELECT Select rows from table\nINSERT Insert rows into table\nUPDATE Update rows in table\nDELETE Delete rows from table\nBEGIN Begin transaction\nCOMMIT Commit transaction\nROLLBACK Rollback transaction\nUSE Switch Databae\nSHOW Show database, table, index, etc\nDESCRIBE Show Table Schema\nEXPLAIN Show SELECT statement index selection\nSET Config parameters\nOPEN Open database\nCLOSE Close database\nDUMP Dump database\nSOURCE Load SQL file\nSHELL Enter interactive shell\nHELP Help\n
XDB> S <TAB>\nSELECT Select rows from table\nSHOW Show database, table, index, etc\nSET Config parameters\nSOURCE Load SQL file\nSHELL Enter interactive shell\nXDB> SE <TAB>\nSELECT Select rows from table\nSET Config parameters\nXDB> SEL <TAB>\nXDB> SELECT\n
XDB> SELECT <TAB>\nXDB> SELECT * <TAB>\nXDB> SELECT * FROM <TAB>\nstudent teacher book\nXDB> SELECT * FROM s<TAB>\nXDB> SELECT * FROM student\n
XDB> SELECT * FROM student <TAB>\nWHERE ORDER BY LIMIT OFFSET AND id name age class score\ninfo\nXDB> SELECT * FROM student WHERE i <TAB>\nid info\n
XDB> SHOW <TAB>\nDATABASES TABLES INDEXES COLUMNS CREATE\n
"},{"location":"client/api-c/","title":"C APIs","text":""},{"location":"client/api-c/#apis-list","title":"APIs List","text":"API Descritpion xdb_conn_t* xdb_open (const char *path) Open a connection void xdb_close (xdb_conn_t *pConn) Close a connection xdb_res_t* xdb_exec (xdb_conn_t* pConn, const char *sql) Execute SQL statement xdb_res_t* xdb_next_result (xdb_conn_t *pConn) Get next SQL statement result bool xdb_more_result (xdb_conn_t* pRes) Check is there more result void xdb_free_result (xdb_res_t* pRes) Free result set xdb_col_t* xdb_column_meta (uint64_t meta, uint16_t iCol) Fetch one row xdb_row_t* xdb_fetch_row (xdb_res_t* pRes) Fetch one row int xdb_column_int (uint64_t meta, void *pRow, uint16_t iCol) Get int column from row float xdb_column_float (uint64_t meta, void *pRow, uint16_t iCol) Get float/double column from row const char * xdb_column_str (uint64_t meta, void *pRow, uint16_t iCol) Get string column from row xdb_stmt_t* xdb_stmt_prepare (xdb_conn_t* pConn, const char *sql) Prepare statement xdb_ret xdb_bind_int (xdb_stmt_t *pStmt, uint16_t para_id, int val) Bind int value xdb_ret xdb_bind_float (xdb_stmt_t *pStmt, uint16_t para_id, float val) Bind float value xdb_ret xdb_bind_str (xdb_stmt_t *pStmt, uint16_t para_id, const char *str) Bind string value xdb_res_t* xdb_stmt_exec (xdb_stmt_t *pStmt) Execute prepared SQL statement void xdb_stmt_close (xdb_stmt_t *pStmt) Free prepared SQL statement xdb_ret xdb_begin (xdb_conn_t* pConn) Begin transaction xdb_ret xdb_commit (xdb_conn_t* pConn) Commit transaction xdb_ret xdb_rollback (xdb_conn_t* pConn) Rollback transaction int xdb_print_row (uint64_t meta, void *pRow, int format) Print row to console const char * xdb_errmsg (xdb_res_t *pRes) Get error/information message const char * xdb_version () Get CrossDB version string"},{"location":"client/api-c/#xdb_open","title":"xdb_open","text":"
If path is :memory: will create or open a memory database, else create or open a on-disk database. This database will be the default DB of this connection.
If path is NULL: Only open a connection. User has to use OPEN DATABASE '[path/]db_name' or CREATE DATABASE '[path/]db_name' or USE DATABASE db_name.
One thread can use only one connection. One connection can only be used by one thread
All opened databases are shared with all opened connections, and they can USE DATABASE db_name to switch connection default DB.
If you know the detailed format, you can access the pointer directly. *(int8_t*)pVal[iCol], *(int16_t*)pVal[iCol], *(int32_t*)pVal[iCol], *(int64_t*)pVal[iCol]
User has to use OPEN DATABASE '[path/]db_name' or CREATE DATABASE '[path/]db_name' or USE DATABASE db_name.
Open a connection and create a default memory database if not exist
xdb_conn_t *pConn = xdb_open (\":memory:\");\n
Open a connection and create a on-disk database school if not exist as the default database
// In current folder\nxdb_conn_t *pConn = xdb_open (\"school\");\n
// In specified folder\nxdb_conn_t *pConn = xdb_open (\"/var/crossdb/school\");\n
"},{"location":"develop/ddl/","title":"Data Model","text":""},{"location":"develop/ddl/#create-and-use-a-database","title":"Create and Use a Database","text":"SQLC
-- Create database in current folder\nCREATE DATABASE school;\n-- Create database in specified folder (must exist)\nCREATE DATABASE '/var/crossdb/school';\n-- Create in-memory database \nCREATE DATABASE test ENGINE=memory;\n
// Create database in current folder\nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE school\");\n// Create database in specified folder (must exist)\nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE '/var/crossdb/school'\");\n// Create in-memory database \nxdb_res_t *pRes = xdb_exec (pConn, \"CREATE DATABASE test ENGINE=memory\");\n
"},{"location":"develop/ddl/#create-a-table","title":"Create a Table","text":"SQLC
CREATE TABLE IF NOT EXISTS student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(256), INDEX (name));\nCREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(256), INDEX (name));\nCREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name));\n
xdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(256), INDEX (name))\");\nxdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(256), INDEX (name))\");\nxdb_res_t *pRes = pRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name))\");\n
INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95);\n\nINSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')\", 'He is a boy.\\nHe likes playing football.\\nWe all like him!');\n
pRes = xdb_exec (pConn, \"INSERT INTO student (id,name,age,class,score) VALUES (1,'jack',10,'3-1',90),(2,'tom',11,'2-5',91),(3,'jack',11,'1-6',92),(4,'rose',10,'4-2',90),(5,'tim',10,'3-1',95)\");\n\npRes = xdb_pexec (pConn, \"INSERT INTO student (id,name,age,class,score,info) VALUES (6,'Tony',10,'3-1',95,'%s')\", \"He is a boy.\\nHe likes playing football.\\nWe all like him!\");\n// check pRes->errcode = 0 and pRes->affected rows\n
pRes = xdb_exec (pConn, \"UPDATE student set age=9 WHERE id = 2\");\n\npRes = xdb_pexec (pConn, \"UPDATE student set age=9 WHERE id = %d\", id);\n\n// check pRes->errcode = 0 and pRes->affected rows\n
pRes = xdb_exec (pConn, \"DELETE FROM student WHERE id = 3\");\n\npRes = xdb_pexec (pConn, \"DELETE FROM student WHERE id = %d\", id);\n\n// check pRes->errcode = 0 and pRes->affected rows\n
Multi-Statements feature can improve performance a lot especailly for client-server mode. As you can run a batch of statements in one query, then get result one by one in parallel. For database doesn't support Multi-Statements, you have to send one statement, wait result, then send next one which will be low performance especailly when network lattency is big.
SQLC
SELECT COUNT(*) FROM student; SELECT id,name FROM student WHERE id=2;\n
SELECT id,name,age,class,score from student WHERE id = 2;\n
xdb_res_t *pRes = xdb_exec (pConn, \"SELECT id,name,age,class,score from student WHERE id = 2\");\n\nxdb_res_t *pRes = xdb_pexec (pConn, \"SELECT id,name,age,class,score from student WHERE id = %d\", id);\n\n// check pRes->errcode = 0\n
printf (\"char value %d\\n\", *(char*)pRow[0]);\nprintf (\"short value %d\\n\", *(short*)pRow[1]);\nprintf (\"int value %d\\n\", *(int*)pRow[2]);\nprintf (\"bigint value %\"PRIi64\"\\n\", *(int64_t*)pRow[3]);\nprintf (\"float value %f\\n\", *(float*)pRow[4]);\nprintf (\"double value %d\\n\", *(double*)pRow[5]);\nprintf (\"string value %s\\n\", *(char*)pRow[6]);\nprintf (\"string len %d\\n\", *(uint16_t*)(pRow[6]-2));\n
Access by API
printf (\"char value %d\\n\", xdb_column_int(pRes->col_meta, pRow, 0));\nprintf (\"short value %d\\n\", xdb_column_int(pRes->col_meta, pRow, 1));\nprintf (\"int value %d\\n\", xdb_column_int(pRes->col_meta, pRow, 2));\nprintf (\"bigint value %\"PRIi64\"\\n\", xdb_column_int64(pRes->col_meta, pRow, 3));\nprintf (\"float value %f\\n\", xdb_column_float(pRes->col_meta, pRow, 4));\nprintf (\"double value %d\\n\", xdb_column_double(pRes->col_meta, pRow, 5));\nprintf (\"string value %s\\n\", xdb_column_str(pRes->col_meta, pRow, 6));\nint len;\nprintf (\"string value %s, len %d\\n\", xdb_column_str2(pRes->col_meta, pRow, 6, &len), len);\n
Current CrossDB uses table-level readwrite lock, only one writer connection thread can modify the table, other writer connection threads will be blocked. However the reader connection threads won't be blocked and they'll see the old values. When the writer connection change is committed, the new value is visible by these reader connections (read committed). In short writer before commit will not block readers to read old values
Even there's errors during statements execution, transaction won't be rollbacked automatically, and user have to issue rollback expilicitly.
"},{"location":"get-started/bench/","title":"Bench Test","text":""},{"location":"get-started/bench/#test-with-1000-rows","title":"Test with 1000 rows","text":"
crossdb/bench/c$ ./a.out 1000\n********************** INSERT 1000 with SQL **********************\nUse time 763ns, QPS 1310615\n********************** Random LKUP 5000000 with SQL **********************\nUse time 951987ns, QPS 5252172\nUse time 921033ns, QPS 5428687\nUse time 915605ns, QPS 5460870\nUse time 926288ns, QPS 5397889\n********************** UPDATE 1000 with SQL **********************\nUse time 760ns, QPS 1315789\n********************** DELETE 1000 with SQL **********************\nUse time 438ns, QPS 2283105\n\n********************** INSERT 1000 with SQL **********************\nUse time 687ns, QPS 1455604\n********************** Random LKUP 10000000 with Prepared STMT **********************\nUse time 294717ns, QPS 33930855\nUse time 297268ns, QPS 33639678\nUse time 298728ns, QPS 33475268\nUse time 295278ns, QPS 33866390\n********************** UPDATE 1000 with Prepared SMTT **********************\nUse time 576ns, QPS 1736111\n********************** DELETE 1000 with Prepared SQL **********************\nUse time 252ns, QPS 3968253\n
"},{"location":"get-started/bench/#test-with-10001000-rows","title":"Test with 1000,1000 rows","text":"
crossdb$ make bench\nor\ncrossdb/bench/c$ ./a.out\n\n********************** INSERT 1000000 with SQL **********************\nUse time 539342ns, QPS 1854111\n********************** Random LKUP 1000000 with SQL **********************\nUse time 336044ns, QPS 2975800\nUse time 333927ns, QPS 2994666\nUse time 329699ns, QPS 3033069\nUse time 331632ns, QPS 3015390\n********************** UPDATE 1000000 with SQL **********************\nUse time 579945ns, QPS 1724301\n********************** DELETE 1000000 with SQL **********************\nUse time 405004ns, QPS 2469111\n\n********************** INSERT 1000000 with SQL **********************\nUse time 527486ns, QPS 1895784\n********************** Random LKUP 10000000 with Prepared STMT **********************\nUse time 1678936ns, QPS 5956153\nUse time 1668971ns, QPS 5991715\nUse time 1670993ns, QPS 5984465\nUse time 1652815ns, QPS 6050283\n********************** UPDATE 1000000 with Prepared SMTT **********************\nUse time 381320ns, QPS 2622469\n********************** DELETE 1000000 with Prepared SQL **********************\nUse time 232181ns, QPS 4306984\n
"},{"location":"get-started/install/","title":"Build and Install","text":""},{"location":"get-started/install/#build","title":"Build","text":"
crossdb$ make\nmake build Build crossdb library and tool\nmake debug Build crossdb library and tool with debug\nmake run Run crossdb tool\nmake clean Clean build result\nmake install Install crossdb(lib&tool&header) to Linux/FreeBSD\nmake uninstall Uninstall crossdb from Linux/FreeBSD\nmake installmacos Install crossdb(lib&tool&header) to MacOS\nmake uninstallmacos Uninstall crossdb from MacOS\nmake example Build and run example (need to install crossdb first)\nmake bench Build and run bench test (need to install crossdb first)\n
pRes = xdb_exec (pConn, \"CREATE TABLE student (id INT PRIMARY KEY, name CHAR(16), age INT, class CHAR(16), score FLOAT, info CHAR(255))\");\nXDB_CHECK(pRes, printf (\"Can't create table student\\n\"); goto error;);\npRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS teacher (id INT PRIMARY KEY, name CHAR(16), age INT, info CHAR(255), INDEX (name))\");\nXDB_CHECK(pRes, printf (\"Can't create table teacher\\n\"); goto error;);\npRes = xdb_exec (pConn, \"CREATE TABLE IF NOT EXISTS book (id INT PRIMARY KEY, name CHAR(64), author CHAR(32), count INT, INDEX (name))\");\nXDB_CHECK(pRes, printf (\"Can't create table book\\n\"); goto error;);\n
DUMP DATABASE db_name [dump_option] ...\n\ndump_option:\n NODROP : Don't add DROP statement\n | NOCREATE : Don't add CREATE statement\n | NODATA : Don't dump ROW data\n | INTO '[path/]outfile' : Dump into file instead of console\n
"},{"location":"sql/data-types/","title":"Data Types","text":"Type Bytes Description Note BOOL 1 Bool, the value range is {true, false}. TBD TINYINT 1 Single-byte integer, the value range is [-128, 127]. SMALLINT 2 Short integer, the value range is [-32768, 32767]. INT 4 Integer, the value range is [-2^31, 2^31-1]. BIGINT 8 Long integer, the value range is [-2^63, 2^63-1]. TINYINT UNSIGNED 1 unsigned single-byte integer, the value range is [0, 255]. TBD SMALLINT UNSIGNED 2 unsigned integer, the value range is [0, 65535]. TBD INT UNSIGNED 4 Unsigned integer, the value range is [0, 2^32-1]. TBD BIGINT UNSIGNED 8 unsigned long integer, the value range is [0, 2^64-1]. TBD TIMESTAMP 8 Default precision is microsecond. TBD FLOAT 4 Floating point number. DOUBLE 8 Double precision floating point number. CHAR [COLLATE collation_name] User-defined, max 65535 Fixed-length UTF-8 string. VARCHAR [COLLATE collation_name] User-defined, max 65535 Variable-Length UTF-8 string. TBD BINARY User-defined, max 65535 Fixed-length binary data. TBD VARBINARY User-defined, max 65535 Variable-Length binary data. TBD"},{"location":"sql/data-types/#collation","title":"Collation","text":"Type Description NOCASE Case insensitive [Default]. BINARY Case sensitive."},{"location":"sql/data-types/#escape-characters","title":"Escape Characters","text":"Escape Character Actual Meaning \\n Line Break \\r Carriage Return \\t tab \\' Single quote ' \\\" Double quote \" ` backtick ` \\ Back Slash \\ \\% % see below for details _ _ see below for details"},{"location":"sql/database/","title":"Database","text":""},{"location":"sql/database/#create-database","title":"Create Database","text":"
LOCKMODE Lock used Description THREAD [default] high-performance thread read-write lock For single process multiple threads access. PROCESS file read-write lock For multiple processes multiple threads access. NOLOCK no lock For test/diag purpose only.
Note
'[path]/db_name' is only valid for embedded database. db_options are default values for new created tables and you can use table_options to overwrite these default values.
"},{"location":"sql/functions/","title":"Functions","text":""},{"location":"sql/functions/#aggregate-functions","title":"Aggregate Functions","text":"Function Return Type Description COUNT(*) BIGINT The number of rows. COUNT(col_name) BIGINT The number of rows in the specified column. MIN(col_name) Same with column The minimum value of a specific column MAX(col_name) Same with column The maximum value of a specific column. SUM(col_name) DOUBLE or BIGINT The sum of a specific column in a table AVG(col_name) DOUBLE The average value of the specified column."},{"location":"sql/indexes/","title":"Index","text":""},{"location":"sql/indexes/#create-index","title":"Create Index","text":"
CREATE [UNIQUE] INDEX idx_name \n [USING {HASH | BTREE}] \n ON tbl_name (col_name,...)\n
"},{"location":"sql/name-limit/","title":"Name and Limit","text":""},{"location":"sql/name-limit/#case-sensitive","title":"Case Sensitive","text":"Type Case-sensitive Keyword False Function False DB Name False Table Name False Column Name False Index Name False"},{"location":"sql/name-limit/#limit","title":"Limit","text":"Type Limit DB Name 64 Table Name 64 Column Name 64 Index Name 64 Single SQL statement 1048576 (1M) DB per process 1024 Table per DB 4095 Rows per Table 2,000,000,000 (2B) Row size 524288 (512K) Index per Table 16 Filter Fields 64"},{"location":"sql/operators/","title":"Operators","text":""},{"location":"sql/operators/#comparison-operators","title":"Comparison Operators","text":"Operator Description Note = Equal to <>, != Not equal to TBD > Greater than TBD < Less than TBD >= Greater than or equal to TBD <= Less than or equal to TBD IS NULL NULL value test TBD IS NOT NULL NOT NULL value test TBD BETWEEN ... AND ... Whether a value is within a range of values TBD NOT BETWEEN ... AND ... Whether a value is not within a range of values TBD IN Whether a value is not within a set of values TBD NOT IN Negation of simple pattern matching TBD LIKE Wildcard match TBD
LIKE is used together with wildcards to match strings. Its usage is described as follows:
'%' matches 0 or any number of characters, '_' matches any single ASCII character.
\\_ is used to match the _ in the string.
"},{"location":"sql/operators/#logical-operators","title":"Logical Operators","text":"Operator Description Note AND Logical AND OR Logical OR TBD"},{"location":"sql/statements/","title":"SQL Statements","text":"Statement Descritpion Note BEGIN Start a new transaction. COMMIT Commits the open transaction if exists. CLOSE DATABASE Close an opened database. Embedded Mode only CREATE DATABASE Create a database. CREATE INDEX Create an index on the specified table. CREATE TABLE Create a new table. DELETE Delete rows in a table. DESCRIBE Describe the specified table. DROP DATABASE Drop a database. DROP INDEX Drop the specified index on the specified table. DROP TABLE Drop the specified table. DUMP DATABASE Dump database into file. EXPLAIN Returns detailed information on how the query is executed. HELP SQL statements help. INSERT Insert data into a table. OPEN DATABASE Open a database on disk. Embedded Mode only ROLLBACK Roll back the open transaction if exists. SELECT Retrieves data from a table. SET AUTOCOMMIT Set session transaction auto-commit. SHELL Enter interactive shell. SHOW COLUMNS Show the list of columns within a given table. SHOW CREATE TABLE Show the CREATE TABLE statement. SHOW DATABASE Show the list of databases. SHOW INDEXES Show the list of indexes associated with a given table. SHOW TABLES Show the list of tables in database. SOURCE Load and execute SQL file. UPDATE Modifies rows in a table. USE Use the database as the current default database."},{"location":"sql/table/","title":"Table","text":""},{"location":"sql/table/#create-table","title":"Create Table","text":"
XDB> DESCRIBE student ;\n+--------+-------+-----+\n| column | type | len |\n+--------+-------+-----+\n| id | INT | 4 |\n| name | CHAR | 16 |\n| age | INT | 4 |\n| class | CHAR | 16 |\n| score | FLOAT | 4 |\n| info | CHAR | 256 |\n+--------+-------+-----+\n6 rows in set (0.023 ms)\n
"},{"location":"sql/transaction/","title":"Transaction and Lock","text":""},{"location":"sql/transaction/#begin-transaction","title":"Begin Transaction","text":"
This command must be executed after BEGIN transaction for performance or prevent other sessions to , and locks will be released after commit transaction.
XDB> SELECT * FROM system.indexes where database='memory';\n+----------+---------+---------+------+----------+\n| database | table | idx_key | type | col_list |\n+----------+---------+---------+------+----------+\n| memory | student | PRIMARY | HASH | id |\n| memory | student | name_2 | HASH | name |\n| memory | teacher | PRIMARY | HASH | id |\n| memory | teacher | name_2 | HASH | name |\n| memory | book | PRIMARY | HASH | id |\n| memory | book | name_2 | HASH | name |\n+----------+---------+---------+------+----------+\n6 rows in set (0.016 ms)\n
"}]}
\ No newline at end of file
diff --git a/server/server/index.html b/server/server/index.html
deleted file mode 100755
index 346daf8..0000000
--- a/server/server/index.html
+++ /dev/null
@@ -1,50 +0,0 @@
- Server - CrossDB
\ No newline at end of file
diff --git a/server/status/index.html b/server/status/index.html
deleted file mode 100755
index 709c845..0000000
--- a/server/status/index.html
+++ /dev/null
@@ -1,33 +0,0 @@
- Status - CrossDB