有人利用AI优化sqlite原版源代码得到了更快的结果。https://sqlite.org/forum/forumpost/1f1b969bf4把他公布的代码取下来测试。https://github.com/ksenxx/sqlite-optimized/编译root6ae32a5ffcde:/par/sqlite-optimized-master# ./configure No installed jimsh or tclsh, building local bootstrap jimsh0 Configuring SQLite version 3.54.0 Host System...x86_64-pc-linux-gnu Build System...x86_64-pc-linux-gnu Source dir /par/sqlite-optimized-master Build dir /par/sqlite-optimized-master C compiler... cc C compiler... c Build C compiler...cc Checking for stdlib.h...ok Checking for sys/types.h...ok Checking if -D_FILE_OFFSET_BITS64 is needed...no SQLITE_DEBUG build? no Looking for install ... /usr/bin/install Checking for int8_t...ok Checking for int16_t...ok Checking for int32_t...ok Checking for int64_t...ok Checking for intptr_t...ok Checking for uint8_t...ok Checking for uint16_t...ok Checking for uint32_t...ok Checking for uint64_t...ok Checking for uintptr_t...ok Checking for gmtime_r...ok Checking for isnan...ok Checking for localtime_r...ok Checking for localtime_s...not found Checking for usleep...ok Checking for utime...ok Checking for pread...ok Checking for pread64...ok Checking for pwrite...ok Checking for pwrite64...ok Checking libs for fdatasync...none needed Checking libs for nanosleep...none needed Checking for sys/types.h...(cached) ok Checking for sys/stat.h...ok Checking for dlfcn.h...ok Checking for unistd.h...ok Checking for stdlib.h...ok Checking for malloc.h...ok Checking for memory.h...ok Checking for string.h...ok Checking for strings.h...ok Checking for inttypes.h...ok Checking for zlib.h...ok Checking libs for deflate...-lz Use amalgamation for builds? yes Use gcov? no test-runner flags: no Use #line macros in the amalgamation: no Checking whether the C compiler accepts -fsanitizeaddress...yes Checking whether the C compiler accepts -fsanitizebounds-strict...yes Checking for a suitable tcl... Checking for tclsh9.1...no Checking for tclsh9.0...no Checking for tclsh8.6...no Checking for tclsh...no WARNING: [ sqlite-check-tcl ]: Cannot determine TCLLIBDIR. WARNING: Cannot find a usable tclConfig.sh file. Use --with-tclDIR to specify a directory where tclConfig.sh can be found. SQLite does not use TCL internally, but some optional components require TCL, including tests and sqlite3_analyzer. Checking for TCL to use for code generation... Checking for dirent.h...ok Checking for sys/time.h...ok Checking for realpath...ok TCL for code generation: jimsh Emscripten SDK? not found Statically link tclsqlite3? no Statically link CLI shell? no Checking whether the C compiler accepts -rpath /usr/local/lib...no Checking whether the C compiler accepts -Wl,-rpath,/usr/local/lib...yes Support threadsafe operation? Checking for libs... Checking libs for pthread_create...none needed Checking libs for pthread_mutexattr_init...none needed Checking libs for dlopen...none needed Loadable extension support enabled. Checking libs for ceil...-lm Enabling math SQL functions ICU support is disabled. Checking for line-editing capability... Using linenoise at /par/linenoise Line-editing support for the sqlite3 shell: linenoise (antirez) Build shared library? yes Build static library? yes Feature flags... - fts3 - fts4 - fts5 - geopoly - rtree - session - update-limit - memsys5 - memsys3 - scanstatus - column-metadata - dbpage - dbstat - carray json Library feature flags: -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_PERCENTILE -DSQLITE_HAVE_ZLIB1 -DSQLITE_THREADSAFE1 Shell options: -DHAVE_LINENOISE1 -DSQLITE_DQS0 -DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PERCENTILE -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION -DSQLITE_HAVE_ZLIB1 -DSQLITE_STRICT_SUBTYPE1 Created Makefile from Makefile.in Created sqlite3.pc from sqlite3.pc.in Created sqlite_cfg.h root6ae32a5ffcde:/par/sqlite-optimized-master# make root6ae32a5ffcde:/par/sqlite-optimized-master# ./sqlite3 SQLite version 3.54.0 2026-08-07 05:31:08 Enter .help for usage hints. Connected to a transient in-memory database. Use .open FILENAME to reopen on a persistent database. SQLite-3.54 memory- SQLite-3.54 memory- .exit两个简单比较测试1.group by generate_seriesrootDESKTOP-59T6U68:/par# ./sqlite35303 --version3.53.32026-06-2620:14:12d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62(64-bit)rootDESKTOP-59T6U68:/par# time echo select sum(value) from generate_series(1,100000000) group by round(log10(value))|./sqlite35303 ╭──────────────────╮ │sum(value)│ ╞══════════════════╡ │6│ │490│ │49590│ │4950617│ │494990550│ │49499924625│ │4949999577625│ │494999997290973│ │4500000053215524│ ╰──────────────────╯real0m28.522suser0m22.832s sys0m5.659s rootDESKTOP-59T6U68:/par# sqlite-optimized-master/sqlite3 --version3.54.02026-08-0705:31:08fafefb59481530255a881f22b1f75b587731867d00eabea39eaec7da2199alt1(64-bit)rootDESKTOP-59T6U68:/par# time echo select sum(value) from generate_series(1,100000000) group by round(log10(value))|sqlite-optimized-master/sqlite3 ╭──────────────────╮ │sum(value)│ ╞══════════════════╡ │6│ │490│ │49590│ │4950617│ │494990550│ │49499924625│ │4949999577625│ │494999997290973│ │4500000053215524│ ╰──────────────────╯real0m21.271suser0m15.949s sys0m5.311s2.使用数独求解SQL求解中级问题WITHRECURSIVE input(sud)AS(VALUES(....754..........8.8.19....3....1.6........34....6817.2.4...6.39......2.53.2.....),(3.........5.7.3..8....28.7.7......43...........39.41.54..3..8..1...4....968...2..)),digits(z,lp)AS(VALUES(1,1)UNIONALLSELECTCAST(lp1ASTEXT),lp1FROMdigitsWHERElp9),x(s,ind)AS(SELECTsud,instr(sud,.)FROMinputUNIONALLSELECTsubstr(s,1,ind-1)||z||substr(s,ind1),instr(substr(s,1,ind-1)||z||substr(s,ind1),.)FROMx,digitsASzWHEREind0ANDNOTEXISTS(SELECT1FROMdigitsASlpWHEREz.zsubstr(s,((ind-1)/9)*9lp,1)ORz.zsubstr(s,((ind-1)%9)(lp-1)*91,1)ORz.zsubstr(s,(((ind-1)/3)%3)*3((ind-1)/27)*27lp((lp-1)/3)*6,1)))SELECTsFROMxWHEREind0;执行。rootDESKTOP-59T6U68:/par# time ./sqlite35303 sudomid3.sql ╭─────────────────────────────────────────────────────────────────────────────────────╮ │ s │ ╞═════════════════════════════════════════════════════════════════════════════════════╡ │ 693875412145632798782194356357421869816957234429368175274519683968743521531286947 │ │ 387419526259763418641528379716285943594631782823974165472396851135842697968157234 │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ real 0m1.128s user 0m1.059s sys 0m0.030s rootDESKTOP-59T6U68:/par# time sqlite-optimized-master/sqlite3 sudomid3.sql ╭─────────────────────────────────────────────────────────────────────────────────────╮ │ s │ ╞═════════════════════════════════════════════════════════════════════════════════════╡ │ 693875412145632798782194356357421869816957234429368175274519683968743521531286947 │ │ 387419526259763418641528379716285943594631782823974165472396851135842697968157234 │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ real 0m1.086s user 0m1.032s sys 0m0.021s