SQLite Library Footprint

Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Support |

## Size Of The SQLite Library

The code space used by the SQLite library depends heavily on the target platform, what compiler and optimization options are used to generate object code, and which optional features of SQLite are included or omitted from the build. This page provides examples of what to expect.

SQLite version 3.7.8 is less than 350KiB in size on x86 with -Os and less than 400KiB (409KB) on x64. The -O2 and -O3 builds are larger, presumably due to loop unrolling and function inlining.

### Case 1

- SuSE Linux 10.1
- GCC 4.1.0
- SQLite version 3.7.8
- x86 (32-bit)

Optimization Setting | Size (bytes) | Run-time (Relative to -O0)
--- | --- | ---
-O0 | 529765 | 1.00
-O1 | 397204 | 0.71
-Os | 333059 | 0.73
-O2 | 418161 | 0.68
-O3 | 828602 | 0.66

### Case 2

- Ubuntu
- GCC 4.5.2
- SQLite version 3.7.8
- x86_64 (64-bit)

Optimization Setting | Size (bytes) | Run-time (Relative to -O0)
--- | --- | ---
-O0 | 625841 | 1.00
-O1 | 455072 | 0.62
-Os | 404201 | 0.59
-O2 | 499543 | 0.53
-O3 | 678465 | 0.54

### Case 3

- Mac OS 10.7.1 (Lion)
- GCC 4.2.1 + LLVM
- SQLite version 3.7.8
- x86_64 (64-bit)

Optimization Setting | Size (bytes) | Run-time (Relative to -O0)
--- | --- | ---
-O0 | 806598 | 1.00
-O1 | 508500 | 0.61
-Os | 481816 | 0.57
-O2 | 614346 | 0.55
-O3 | 661622 | 0.55

## The Effect Of Compile-Time Options On Library Size

The next study shows the effect that various compile-time options for SQLite have on the size of the resulting library file. The following size figures are computed with an early beta of SQLite version 3.7.9 using GCC version 4.6.1 for X86_64 running on Ubuntu with the -Os option. Actual sizes and size differences may vary by compiler and system.

Compile-Time Option | Library Footprint | Difference From Baseline | Percentage Difference
--- | --- | --- | ---
All OMIT options | 248363 | -155714 | -38.536%
SQLITE_OMIT_TRIGGER | 382038 | -22039 | -5.454%
SQLITE_OMIT_WAL | 388281 | -15796 | -3.909%
SQLITE_OMIT_FLOATING_POINT | 390469 | -13608 | -3.368%
SQLITE_OMIT_VIRTUALTABLE | 391156 | -12921 | -3.198%
SQLITE_OMIT_PRAGMA | 391292 | -12785 | -3.164%
SQLITE_OMIT_FOREIGN_KEY | 393555 | -10522 | -2.604%
SQLITE_OMIT_AUTOVACUUM | 395589 | -8488 | -2.101%
SQLITE_OMIT_SUBQUERY | 396313 | -7764 | -1.921%
SQLITE_OMIT_COMPOUND_SELECT | 396810 | -7267 | -1.798%
SQLITE_OMIT_EXPLAIN | 397011 | -7066 | -1.749%
SQLITE_OMIT_DATETIME_FUNCS | 397179 | -6898 | -1.707%
SQLITE_OMIT_INTEGRITY_CHECK | 397438 | -6639 | -1.643%
SQLITE_OMIT_ATTACH | 397951 | -6126 | -1.516%
SQLITE_OMIT_ALTERTABLE | 398344 | -5733 | -1.419%
SQLITE_OMIT_UTF16 | 399069 | -5008 | -1.239%
SQLITE_OMIT_SHARED_CACHE | 399249 | -4828 | -1.195%
SQLITE_OMIT_INCRBLOB | 399889 | -4188 | -1.036%
SQLITE_OMIT_ANALYZE | 400207 | -3870 | -0.958%
SQLITE_OMIT_AUTHORIZATION | 401002 | -3075 | -0.761%
SQLITE_OMIT_VACUUM | 401026 | -3051 | -0.755%
SQLITE_OMIT_PAGER_PRAGMAS | 401168 | -2909 | -0.720%
SQLITE_OMIT_OR_OPTIMIZATION | 401374 | -2703 | -0.669%
SQLITE_OMIT_VIEW | 401500 | -2577 | -0.638%
SQLITE_OMIT_BUILTIN_TEST | 401711 | -2366 | -0.586%
SQLITE_OMIT_XFER_OPT | 402052 | -2025 | -0.501%
SQLITE_OMIT_AUTOINCREMENT | 402098 | -1979 | -0.490%
SQLITE_OMIT_SCHEMA_PRAGMAS | 402312 | -1765 | -0.437%
SQLITE_OMIT_TRACE | 402369 | -1708 | -0.423%
SQLITE_OMIT_LOAD_EXTENSION | 402611 | -1466 | -0.363%
SQLITE_OMIT_AUTOMATIC_INDEX | 402685 | -1392 | -0.344%
SQLITE_OMIT_LIKE_OPTIMIZATION | 402928 | -1149 | -0.284%
SQLITE_OMIT_REINDEX | 402975 | -1102 | -0.273%
SQLITE_OMIT_GET_TABLE | 402999 | -1078 | -0.267%
SQLITE_OMIT_COMPLETE | 403135 | -942 | -0.233%
SQLITE_OMIT_TEMPDB | 403200 | -877 | -0.217%
SQLITE_OMIT_BTREECOUNT | 403301 | -776 | -0.192%
SQLITE_OMIT_LOCALTIME | 403307 | -770 | -0.191%
SQLITE_OMIT_COMPILEOPTION_DIAGS | 403309 | -768 | -0.190%
SQLITE_OMIT_FLAG_PRAGMAS | 403441 | -636 | -0.157%
SQLITE_OMIT_QUICKBALANCE | 403455 | -622 | -0.154%
SQLITE_OMIT_CAST | 403457 | -620 | -0.153%
SQLITE_OMIT_CHECK | 403501 | -576 | -0.143%
SQLITE_OMIT_MEMORYDB | 403555 | -522 | -0.129%
SQLITE_OMIT_BLOB_LITERAL | 403619 | -458 | -0.113%
SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS | 403748 | -329 | -0.081%
SQLITE_OMIT_LOOKASIDE | 403753 | -324 | -0.080%
SQLITE_OMIT_AUTOINIT | 403759 | -318 | -0.079%
SQLITE_DISABLE_DIRSYNC | 403782 | -295 | -0.073%
SQLITE_OMIT_DECLTYPE | 403794 | -283 | -0.070%
SQLITE_OMIT_DEPRECATED | 403794 | -283 | -0.070%
SQLITE_OMIT_BETWEEN_OPTIMIZATION | 403929 | -148 | -0.037%
SQLITE_OMIT_PROGRESS_CALLBACK | 403957 | -120 | -0.030%
SQLITE_OMIT_TRUNCATE_OPTIMIZATION | 403984 | -93 | -0.023%
SQLITE_OMIT_TCL_VARIABLE | 404003 | -74 | -0.018%
Baseline SQLite Library Size | 404077 | 0 | 0.000%
SQLITE_DISABLE_LFS | 404105 | +28 | +0.007%
SQLITE_ENABLE_IOTRACE | 404108 | +31 | +0.008%
SQLITE_OMIT_AUTORESET | 404143 | +66 | +0.016%
SQLITE_ENABLE_MEMORY_MANAGEMENT | 404348 | +271 | +0.067%
SQLITE_ENABLE_UPDATE_DELETE_LIMIT | 404780 | +703 | +0.174%
SQLITE_ENABLE_COLUMN_METADATA | 405198 | +1121 | +0.277%
SQLITE_ENABLE_UNLOCK_NOTIFY | 405371 | +1294 | +0.320%
SQLITE_ENABLE_ATOMIC_WRITE | 405426 | +1349 | +0.334%
SQLITE_ENABLE_MEMSYS5 | 406290 | +2213 | +0.548%
SQLITE_ENABLE_MEMSYS3 | 406927 | +2850 | +0.705%
SQLITE_OMIT_WSD | 408536 | +4459 | +1.104%
SQLITE_ENABLE_STAT3 | 410352 | +6275 | +1.553%
SQLITE_ENABLE_RTREE | 422554 | +18477 | +4.573%
SQLITE_ENABLE_FTS3 | 467173 | +63096 | +15.615%
SQLITE_ENABLE_FTS4 | 467185 | +63108 | +15.618%