Commit Graph

12681 Commits

Author SHA1 Message Date
drh
0f8f26716c Add support for using separate worker threads to speed large sorts.
The SQLITE_MAX_WORKER_THREADS and SQLITE_DEFAULT_WORKER_THREADS compile-time
options and the SQLITE_LIMIT_WORKER_THREADS argument to 
sqlite3_limit() and the "PRAGMA threads=N" pragma are added.

FossilOrigin-Name: b1c0f0bc1bd8a3477cd7a7ab510f0442ac88b517
2014-09-01 17:36:46 +00:00
drh
19541f3018 Attempt to make the xDelete method of the unix VFS more robust on VxWorks.
FossilOrigin-Name: b0f6b91f36b503d8ba8d5257bb194f8c1afb4833
2014-09-01 13:37:55 +00:00
drh
ee6438df0b Micro-optimizations in sqlite3BtreeNext() and sqlite3BtreePrevious().
FossilOrigin-Name: 839c7996eecd5480152c514555b9aa1121a69ce0
2014-09-01 13:29:32 +00:00
mistachkin
31970cca38 Fix harmless compiler warnings for MSVC.
FossilOrigin-Name: 3ef3246120d72dffe469733bb21667a548af0a44
2014-09-01 01:16:49 +00:00
drh
44dec87538 In the command-line shell, added options --lookaside, --pagecache, and
--scratch used to configure auxiliary memories.

FossilOrigin-Name: f61db04be4d7fb21b7f721647c37c45e283ffbea
2014-08-30 15:49:25 +00:00
drh
6b2129aaaf Disable worker threads when SQLITE_THREADSAFE=0. Set the default compile-time
maximum number of worker threads to 8 and honor the
SQLITE_DEFAULT_WORKER_THREADS compile-time constant (which defaults to 0).

FossilOrigin-Name: 33fa0410499900dd8beb44b9a8ffbd9f4b68c8d8
2014-08-29 19:06:07 +00:00
drh
43cbe14378 Fix the speedtest1.c test program to set the worker thread count using
the threads pragma.

FossilOrigin-Name: 2ab4b5adc60b52bf2d2b79968d226b8dd7d2ab3b
2014-08-29 18:06:33 +00:00
drh
111544cbb4 Add SQLITE_LIMIT_WORKER_THREADS for controlling the maximum number of
worker threads.

FossilOrigin-Name: 1b598c68f32db635d1cea1373bedc434aa60cf08
2014-08-29 16:20:47 +00:00
drh
503ae86508 Merge recent performance enhancements from trunk onto the threads branch.
FossilOrigin-Name: 35c44a3c73e2e8b14ff194c41986f4bdb9dfe737
2014-08-29 14:40:07 +00:00
drh
46048d2f24 Note a fault after all, rather a testing mistake.
Move this change back to trunk.
Was: Avoid an unnecessary OP_Move operation for expression subqueries.

FossilOrigin-Name: 2a74129a21f9745f1363f844807e2d10201a3f40
2014-08-29 14:20:46 +00:00
drh
53932ce8fa Avoid an unnecessary OP_Move operation for expression subqueries.
FossilOrigin-Name: 462f42af52f146fd328ddcbbe78c8444ef7bd2c3
2014-08-29 12:29:39 +00:00
drh
ae914d783a Improved WHERETRACE messages for the estimated output row reductions from
range scans.

FossilOrigin-Name: fdd478bb11eb9e244a7a1fb628ac27c53830fb24
2014-08-28 19:38:22 +00:00
drh
defb8223b4 Fix a problem causing an inaccurate stat4-based estimate for the
number of rows visited by a range scan.

FossilOrigin-Name: a9daf3ac444b896013f4054051937d49a597624a
2014-08-28 17:30:28 +00:00
drh
b34fc5be6d Add a testcase() macro to help verfity the row estimation logic.
FossilOrigin-Name: 6ba609522ea7325341fad93bdb5f869c6506dea4
2014-08-28 17:20:37 +00:00
dan
7fa0631ece Fix a problem causing an inaccurate stat4-based estimate for the number of rows visited by a range scan.
FossilOrigin-Name: 052d89b554a947b7e420b7feb6650f5069b7cefa
2014-08-28 16:01:31 +00:00
drh
5418b1298f Fix a formatting error ("%d" needed in place of "%g") on a WHERETRACE
macro inside of the query planner.  This fix applies to debugging logic
only.

FossilOrigin-Name: c931ca2b7763cf894ece26ca4775d638876107e9
2014-08-28 13:42:13 +00:00
drh
bc59ac0e26 Refactor the sqlite3PcacheFetch() routine into three separate routines,
which are significantly faster overall and about 100 bytes smaller in
size as well.

FossilOrigin-Name: bdb6e4978d1a26d5f795262172605184264ede9c
2014-08-27 23:18:01 +00:00
mistachkin
a1dc42aa91 Add a VDBE synopsis comment for clarification.
FossilOrigin-Name: 029a6dc744c24e7be482298c678af8a115d6a87b
2014-08-27 17:53:40 +00:00
dan
54ae4e3179 Add a missing ticket number to a comment in index7.test.
FossilOrigin-Name: d8b1c4336145d436241863c3525530e24a24799b
2014-08-27 17:48:15 +00:00
dan
0829169f1e When determining whether or not a partial index is usable, do not assume that the cursor number assigned to each table in the query is the same as its index in the FROM clause. Fix for ticket [98d973b8f5].
FossilOrigin-Name: fcebca166f15431764b82a8b267f11d28386e975
2014-08-27 17:37:20 +00:00
drh
9bd038f12e In the sqlite3_context object, keep a pointer to the result value rather
than storing the result value in the sqlite3_context object and using
memcpy() to move the value back into its register
after the function returns.  This runs faster and saves over 500 bytes
of code space.

FossilOrigin-Name: 6c1ee3e388eb110de815270467b1e50592c0ba6c
2014-08-27 14:14:06 +00:00
drh
6c9f8e67de Factor out the exception paths from sqlite3ValueToText() into a separate
function so that the main routine is much faster for the common case of
no required type or encoding conversions.

FossilOrigin-Name: 1624916c6e9bc5dbcfa146b316a99ac8fecb13a9
2014-08-27 03:28:50 +00:00
drh
b63388b6a4 Performance enhancement in sqlite3VdbeMemNulTerminate().
FossilOrigin-Name: f94cacc393e895522b92c9717c53357afc918d60
2014-08-27 00:50:11 +00:00
drh
c3031c61ef Change the page cache so that a new sqlite3_pcache object is allocated as
soon as the page cache is opened, not delayed until the first fetch request.
This give a noticable performance boost.  The interface between pager and
the page cache has changed slightly, which might break ZIPVFS.

FossilOrigin-Name: f1f94a971e031e784f8c30a6faf829df58709329
2014-08-26 15:06:49 +00:00
drh
028696c4cc Remove the SQLITE_CONFIG_WORKER_THREADS configuration parameter. The number
of worker threads in the sorter is now determined only by the
PRAGMA threads=N setting.

FossilOrigin-Name: e3305d4b4efcbe06945ce7f6ec0f2e864244aaf9
2014-08-25 23:44:44 +00:00
drh
6c4ec84256 Merge the CAST operator enhancements from trunk.
FossilOrigin-Name: 6c8f86e4e08d5d57e21496277613e0f9dcc06514
2014-08-25 22:43:17 +00:00
drh
05bbb2e824 Add an assert() and five testcase() macros to the OP_Cast opcode implementation
to help verify that it is fully tested.

FossilOrigin-Name: af364cce9da0961593ef876b646197f82df08ad5
2014-08-25 22:37:19 +00:00
drh
ec3e4f753b Minor changes to the CAST logic to make it more testable.
FossilOrigin-Name: 1ad70ec550c004160d9c0c57e6c416812cdead5e
2014-08-25 21:11:01 +00:00
drh
21b0e73354 Test cases added for using unary "+" and CAST operators on the RHS of range
constraints and verifying that STAT3/4 can use those constraints.

FossilOrigin-Name: 42505e5a810832442699ca54a46637c50e7f9e71
2014-08-25 20:21:07 +00:00
drh
4169e430a2 Allow CAST expressions and unary "+" operators to be used in the DEFAULT
argument of an ALTER TABLE ADD COLUMN and to be understand on the RHS of
range constraints interpreted by STAT3/4.  This involves a rewrite of the
implementation of the CAST operator.

FossilOrigin-Name: 91d8a8d0b792ea5c4fe68fd9caaf3345eddea486
2014-08-25 20:11:52 +00:00
dan
f741e0491e In cases where stat4 data is available but cannot be used because the rhs of a range constraint is too complex a expression, fall back to using the default estimates for number of rows scanned.
FossilOrigin-Name: e06dc6f0c35f87c44292c71677111b74f073a5c4
2014-08-25 18:29:38 +00:00
drh
034596153d Query or change the maximum number of worker threads allowed on each
database connection separately using the "PRAGMA threads" command.

FossilOrigin-Name: 29c5e8a7c9d7ce349a1e1d72082d23450e877b45
2014-08-25 15:13:22 +00:00
drh
4d015c6902 Merge the recent performance enhancements implemented on trunk into the
threads branch.

FossilOrigin-Name: dfdc900f5d1a31ee5c5f35a630c4a8253e69093b
2014-08-25 13:27:02 +00:00
drh
c137807a87 Remove the pager_lookup() function since it is redundant with
sqlite3PagerLookup().

FossilOrigin-Name: 54164ce47cfc3ad5dd8797114e4ba78811f23bef
2014-08-25 11:33:41 +00:00
drh
12b7c7d8c3 Change the name of the VdbeMemRelease() macro to VdbeMemReleaseExtern() to
more accurately reflect what it does.  Performance enhancement to the
sqlite3VdbeMemRelease() function.

FossilOrigin-Name: 3ca5846da7da5e08192a4c96288197be3b7ab6f7
2014-08-25 11:20:27 +00:00
drh
4274dae9e9 The sqlite3VdbeChangeEncoding() routine goes about 3x faster if the
sqlite3VdbeMemTranslate() subroutine is not inlined.

FossilOrigin-Name: 0c7e1b875a14ff9d71af7bb125a0272a23d57353
2014-08-24 02:53:23 +00:00
drh
f063e08fd9 Patch the sqlite3PagerWrite() method in the Pager to run a bit faster.
FossilOrigin-Name: c63311e2f3344363a5ed99838fb5850004eaee30
2014-08-24 01:32:43 +00:00
drh
efbf044583 Faster implementation of pcache1Fetch()
FossilOrigin-Name: 0371cc3bb07448bcd64fd671f3e71bb7f30deb4d
2014-08-23 23:15:31 +00:00
drh
b50c65d561 Faster implementation of the sqlite3ApiExit() routine.
FossilOrigin-Name: bd41d394d48516eb7d8ddc46abdcb427aa80173e
2014-08-23 20:25:53 +00:00
drh
b4586f1254 Another memory allocator performance optimization.
FossilOrigin-Name: 6da6f46d0c43e3b68c21f514ddf8ee663c20f249
2014-08-23 19:42:06 +00:00
drh
3bdffddc41 Fix a variable-declaration after code problem in btree.c. Harmless in
GCC and CLANG but unacceptable for MSVC.

FossilOrigin-Name: 45abd5c0bad2847861f3b26a7040490aa9bb1332
2014-08-23 19:08:09 +00:00
drh
3ccd5bf89e Changes to sqlite3ScratchMalloc() that make the entire memory allocation
interface a little faster and about 100 bytes smaller.

FossilOrigin-Name: f83daa16f65ef35062412e88c214852a4aeb3da2
2014-08-23 19:04:55 +00:00
drh
9de4a17185 Make the implementation of the sqlite3_aggregate_context() interface faster
for second an subsequent invocations.  This helps all aggregate functions to
perform better.

FossilOrigin-Name: 802148f3110462eac939d53ce08eb9a2f6aac739
2014-08-23 18:17:19 +00:00
drh
f1a89ede4a Improved performance in the type handling of arithmetic operators in the VDBE.
FossilOrigin-Name: 0c0a603950c97837442d82886f947aab0acbd805
2014-08-23 17:41:15 +00:00
drh
bd9507c8da Performance optimization in the applyAffinity() logic inside the VDBE.
FossilOrigin-Name: 25f2246be404f38b4f8dd70397cd1454d46358c4
2014-08-23 17:21:37 +00:00
drh
6848dad894 Another performance tweak: Split the sqlite3BtreeCursorHasMoved() routine
into two with the second routine named sqlite3BtreeCursorRestore().  The first
now only reports whether or not the cursor has moved and the second tries to
restore the cursor.  This allows the sqlite3VdbeCursorMoveto() routine to be
refactored to avoid stack pointer movements, for a noticable performance gain.

FossilOrigin-Name: ce123b5c592556a8cd38b01fcc91ba76231d3098
2014-08-22 23:33:03 +00:00
drh
637f3d83b9 Factor the saveAllCursors() routine of btree.c into two separate routines,
for a noticable performance improvement.

FossilOrigin-Name: 3eb084390382c108e9b0ff0b29dede58ebb149bc
2014-08-22 22:26:07 +00:00
drh
75e2a2d362 Performance enhancements in the b-tree mutex logic.
FossilOrigin-Name: 8914530644f938a7a98e25ea1fb0bca1f9d79101
2014-08-22 21:58:10 +00:00
drh
a8dcba9199 Combine the pcacheAddToDirtyList() and pcacheRemoveFromDirtyList() routines
into a single pcacheManageDirtyList() routine.  The resulting binary code is
slightly faster and a few bytes smaller.

FossilOrigin-Name: 6bcf1af6a48dbda5ac6f6b3b02810bdfc4730000
2014-08-22 20:35:29 +00:00
drh
2f2b2b8580 Performance enhancement in sqlite3PutVarint().
FossilOrigin-Name: a929be551924144c9bc7aab608404d59e479abb5
2014-08-22 18:48:25 +00:00