17
r e v i e w

Sqlite

Embed Size (px)

DESCRIPTION

A simple review over one of the most lightest RDBMS.

Citation preview

Page 1: Sqlite

r e v i e w

Page 2: Sqlite

What is SQLLite ?

Single file database

Works as library instead of service

Open source RDBMS

Cross Platform database

Page 3: Sqlite

Features :Transactions are ACID

No setup or administration need to use

Implements most of SQL-92

Support terabyte size of database

Faster than popular RDBMS in some cases

Page 4: Sqlite

1000 INSERTs 25000 INSERTs0

2

4

6

8

10

12

14

0.114

2.184

4.374.9

13.061

0.9140.223

0.757

MySqlPostgreSQLSQLite v2SQLite v3

Benchmark - INSERT1000 INSERTsCREATE TABLE t1(a INTEGER, b INTEGER, c VARCHAR(100));INSERT INTO t1 VALUES(1,13153,'thirteen thousand one hundred fifty three');INSERT INTO t1 VALUES(2,75560,'seventy five thousand five hundred sixty');... 995 lines omittedINSERT INTO t1 VALUES(998,66289,'sixty six thousand two hundred eighty nine');INSERT INTO t1 VALUES(999,24322,'twenty four thousand three hundred twenty two');INSERT INTO t1 VALUES(1000,94142,'ninety four thousand one hundred forty two');

25000 INSERTs in a transactionBEGIN;CREATE TABLE t2(a INTEGER, b INTEGER, c VARCHAR(100));INSERT INTO t2 VALUES(1,59672,'fifty nine thousand six hundred seventy two');... 24997 lines omittedINSERT INTO t2 VALUES(24999,89569,'eighty nine thousand five hundred sixty nine');INSERT INTO t2 VALUES(25000,94666,'ninety four thousand six hundred sixty six');

Page 5: Sqlite

Test 1 Test 20

2

4

6

8

10

12

14

16

2.76

4.64

3.629

13.409

2.4943.362

2.526

0.757

MySqlPostgreSQLSQLite v2SQLite v3

Benchmark - SELECT100 SELECTs without an indexBEGIN;SELECT count(*), avg(b) FROM t2 WHERE b>=0 AND b<1000;SELECT count(*), avg(b) FROM t2 WHERE b>=100 AND b<1100;... 96 lines omittedSELECT count(*), avg(b) FROM t2 WHERE b>=9800 AND b<10800;SELECT count(*), avg(b) FROM t2 WHERE b>=9900 AND b<10900;COMMIT;

100 SELECTs on a string comparisonBEGIN;SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%one%';SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%two%';... 96 lines omittedSELECT count(*), avg(b) FROM t2 WHERE c LIKE '%ninety nine%';SELECT count(*), avg(b) FROM t2 WHERE c LIKE '%one hundred%';

Page 6: Sqlite

1000 UPDATEs 25000 UPDATEs0

2

4

6

8

10

12

14

16

18

20

8.41 8.134

1.739

18.797

0.637

3.52

0.638

3.372

MySqlPostgreSQLSQLite v2SQLite v3

Benchmark - UPDATE1000 UPDATEs without an indexBEGIN;UPDATE t1 SET b=b*2 WHERE a>=0 AND a<10;UPDATE t1 SET b=b*2 WHERE a>=10 AND a<20;... 996 lines omittedUPDATE t1 SET b=b*2 WHERE a>=9980 AND a<9990;UPDATE t1 SET b=b*2 WHERE a>=9990 AND a<10000;COMMIT;

25000 UPDATEs with an indexBEGIN;UPDATE t2 SET b=468026 WHERE a=1;UPDATE t2 SET b=121928 WHERE a=2;... 24996 lines omittedUPDATE t2 SET b=35065 WHERE a=24999;UPDATE t2 SET b=347393 WHERE a=25000;COMMIT;

Page 7: Sqlite

DELETE without an index DELETE with an index0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

0.975

2.262

1.5091.316

4.004

2.068

0.560.752

MySqlPostgreSQLSQLite v2SQLite v3

Benchmark - DELETE

DELETE without an indexDELETE FROM t2 WHERE c LIKE '%fifty%';

DELETE with an indexDELETE FROM t2 WHERE a>10 AND a<20000;

Page 8: Sqlite

Features :Transactions are ACID

No setup or administration need to use

Implements most of SQL-92

Support terabyte size of database

Faster than popular RDBMS in some cases

Cross PlatformUnix(Linux and Mac OS X) , OS/2 , Windows

Comes with a standalone command line interface

Page 9: Sqlite

Disadvantages :Problem with foreign keys

Single user

Not supported stored procedures

Low speed on large tables

No security facility

Problem with sorting Unicode data

Problem with 64bit systems

Page 10: Sqlite

Uses of SQLite:

Application file format

Database for gadgets

Website database

Enterprise and dedicated RDBMS

Page 11: Sqlite

How to use: Include filesCommand Line ShellInterfaces

http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers

http://www.sqlite.org/download.html

Page 12: Sqlite

Well-Known Users of SQLite

Page 13: Sqlite
Page 14: Sqlite

Adobe

Photoshop Lightroom

Adobe AIR

Page 15: Sqlite

Google

Google Gears

Google Desktop

Page 16: Sqlite

Apple

Safari

Apple Mail

iPad iPhone iPod Touch

Page 17: Sqlite

Thank [email protected]