Index: tool/mklsmapi.tcl ================================================================== --- tool/mklsmapi.tcl +++ tool/mklsmapi.tcl @@ -182,11 +182,11 @@ puts $document_preamble puts "

LSM API Topics

" puts
    puts $document_toc puts
-set s "display:block;float:left;width:40ex" +set s "display:block;float:left;width:35ex" puts "

All LSM API Functions

" foreach sym [lsort $document_functions] { puts "$sym" } puts "
" Index: www/lsmapi.wiki ================================================================== --- www/lsmapi.wiki +++ www/lsmapi.wiki @@ -33,85 +33,85 @@
  • Extracting Data From Database Cursors
  • Change these!!

    All LSM API Functions

    -lsm_begin -lsm_checkpoint -lsm_ckpt_size -lsm_close -lsm_commit -lsm_config -lsm_config_log -lsm_config_work_hook -lsm_csr_close -lsm_csr_cmp -lsm_csr_first -lsm_csr_key -lsm_csr_last -lsm_csr_next -lsm_csr_open -lsm_csr_prev -lsm_csr_seek -lsm_csr_valid -lsm_csr_value -lsm_delete -lsm_delete_range -lsm_flush -lsm_free -lsm_info -lsm_insert -lsm_new -lsm_open -lsm_rollback -lsm_tree_size -lsm_work +lsm_begin +lsm_checkpoint +lsm_ckpt_size +lsm_close +lsm_commit +lsm_config +lsm_config_log +lsm_config_work_hook +lsm_csr_close +lsm_csr_cmp +lsm_csr_first +lsm_csr_key +lsm_csr_last +lsm_csr_next +lsm_csr_open +lsm_csr_prev +lsm_csr_seek +lsm_csr_valid +lsm_csr_value +lsm_delete +lsm_delete_range +lsm_flush +lsm_free +lsm_info +lsm_insert +lsm_new +lsm_open +lsm_rollback +lsm_tree_size +lsm_work

    All LSM API Types

    -lsm_compress +lsm_compress

    All LSM API Constants

    -LSM_BUSY -LSM_CANTOPEN -LSM_CONFIG_AUTOCHECKPOINT -LSM_CONFIG_AUTOWORK -LSM_CONFIG_BLOCK_SIZE -LSM_CONFIG_GET_COMPRESSION -LSM_CONFIG_LOG_SIZE -LSM_CONFIG_MAX_FREELIST -LSM_CONFIG_MMAP -LSM_CONFIG_MULTIPLE_PROCESSES -LSM_CONFIG_NMERGE -LSM_CONFIG_PAGE_SIZE -LSM_CONFIG_SAFETY -LSM_CONFIG_SET_COMPRESSION -LSM_CONFIG_USE_LOG -LSM_CONFIG_WRITE_BUFFER -LSM_CORRUPT -LSM_ERROR -LSM_FULL -LSM_INFO_ARRAY_PAGES -LSM_INFO_ARRAY_STRUCTURE -LSM_INFO_DB_STRUCTURE -LSM_INFO_FREELIST -LSM_INFO_LOG_STRUCTURE -LSM_INFO_NREAD -LSM_INFO_NWRITE -LSM_INFO_PAGE_ASCII_DUMP -LSM_INFO_PAGE_HEX_DUMP -LSM_IOERR -LSM_MISUSE -LSM_NOMEM -LSM_OK -LSM_PROTOCOL -LSM_SAFETY_FULL -LSM_SAFETY_NORMAL -LSM_SAFETY_OFF -LSM_SEEK_EQ -LSM_SEEK_GE -LSM_SEEK_LE -LSM_SEEK_LEFAST +LSM_BUSY +LSM_CANTOPEN +LSM_CONFIG_AUTOCHECKPOINT +LSM_CONFIG_AUTOWORK +LSM_CONFIG_BLOCK_SIZE +LSM_CONFIG_GET_COMPRESSION +LSM_CONFIG_LOG_SIZE +LSM_CONFIG_MAX_FREELIST +LSM_CONFIG_MMAP +LSM_CONFIG_MULTIPLE_PROCESSES +LSM_CONFIG_NMERGE +LSM_CONFIG_PAGE_SIZE +LSM_CONFIG_SAFETY +LSM_CONFIG_SET_COMPRESSION +LSM_CONFIG_USE_LOG +LSM_CONFIG_WRITE_BUFFER +LSM_CORRUPT +LSM_ERROR +LSM_FULL +LSM_INFO_ARRAY_PAGES +LSM_INFO_ARRAY_STRUCTURE +LSM_INFO_DB_STRUCTURE +LSM_INFO_FREELIST +LSM_INFO_LOG_STRUCTURE +LSM_INFO_NREAD +LSM_INFO_NWRITE +LSM_INFO_PAGE_ASCII_DUMP +LSM_INFO_PAGE_HEX_DUMP +LSM_IOERR +LSM_MISUSE +LSM_NOMEM +LSM_OK +LSM_PROTOCOL +LSM_SAFETY_FULL +LSM_SAFETY_NORMAL +LSM_SAFETY_OFF +LSM_SEEK_EQ +LSM_SEEK_GE +LSM_SEEK_LE +LSM_SEEK_LEFAST

    LSM Error Codes

    #define LSM_OK 0 #define LSM_ERROR 1 #define LSM_BUSY 5 Index: www/lsmusr.wiki ================================================================== --- www/lsmusr.wiki +++ www/lsmusr.wiki @@ -71,13 +71,65 @@

    If required, it is possible to configure LSM to use external data compression and/or encryption functions to transform data before it is stored in the database file. -

    Say something about the difference in performance characteristics -between a b-tree and whatever it is LSM is. Link the performance graphs page. - +

    Many database systems that support range queries, including SQLite 3, Berkeley DB and Kyoto Cabinet, are +based on a b-tree data +structure or variant thereof. A b-tree structure minimizes the number of +disk sectors that must be read from disk when searching the database for a +specific key. However, b-tree implementations usually suffer from poor write +localization - updating the contents of a b-tree often involves modifying the +contents of nodes scattered throughout the database file. If the database is +stored on a spinning disk (HDD), then the disk heads must be moved before +writing non-contiguous sector, which is extremely slow. If the database is +stored on solid state storage (SDD) a similar phenomena is encountered due +to the large erase-block sizes. In general, writing to a series of contiguous +disk sectors is orders of magnitude faster than updating to the same number +of disk sectors scattered randomly throughout a large file. Additionally, +b-tree structures are prone to fragmentation, reducing the speed of range +queries. + +

    Todo: Should have references for the claims above. + +

    Also, fix the link in the next paragraph to point to something more +specific. + +

    LSM uses a different data structure that makes the +following performance tradeoffs relative to a b-tree: + +

    + +

    In other words, all things considered equal, writing to an LSM database +should be very fast and scanning through large ranges of keys should also +perform well, but searching the database for specific keys may be slightly +slower than when using a b-tree based system. Additionally, avoiding random +writes in favour of largely contiguous updates can significantly reduce the +wear on SSD or flash memory devices. + +

    Although it has quite different features to LSM in other respects, +LevelDB makes similar performance tradeoffs. + +

    Benchmark test results for LSM are available here. Todo: Link to a page +with performance graphs here +

    2. Using LSM in Applications

    LSM is not currently built or distributed independently. Instead, it is part of the SQLite4 library. To use LSM in an application, the application