-C When\sopening\sthe\s*-shm\sfile\sfor\sa\sreadonly\sdatabase,\stry\sto\sopen\sit\sin\sread-write\smode\sbefore\sfalling\sback\sto\sreadonly.\sThis\sis\sin\scase\ssome\sother\sread/write\sconnection\swithin\sthe\ssame\sprocess\suses\sthe\ssame\sfile\sdescriptor.
-D 2016-11-17T14:02:50.490
+C Increase\sthe\sestimated\scost\sof\ssorting\swhen\ssorting\swide\sresults\ssets,\sto\naccount\sfor\sthe\sextra\sstorage\sspace\sand\sI/O\srequired\sfor\sthe\sexternal\ssort.
+D 2017-02-17T21:23:25.595
F Makefile.in c9c70541089a9755069a9dad0b609cf14a382649
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc a8af814f63c124db048517b63a0b8650c3fc26fc
F src/wal.c b782fa386a4f7b5a8c974f481d8bc004464849a2
F src/wal.h 8fed212c25dc0b33abb9c287ccd8e242796a73e8
F src/walker.c 91a6df7435827e41cff6bb7df50ea00934ee78b0
-F src/where.c 952f76e7a03727480b274b66ca6641b1657cd591
+F src/where.c a7a99b84a975d1c0518c72041ff6c3a9898fd102
F src/whereInt.h 2bcc3d176e6091cb8f50a30b65c006e88a73614d
F src/wherecode.c 717a65294df46f30e9b9933d2a63a4bcbca5a9a8
F src/whereexpr.c a83d70154f3bbce5051a7e9710021f647c0fe4f2
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 0e5ffd9123d6d2d2b8f3701e8a73cc98a3a7ff5f
-R dd715a7090f8ccbb07a44c145e36e97f
-U dan
-Z dc2784f452c216a6da4c2c53fde33522
+P a07c581e88aa4d9835f6144c0fd5e58ef42f14ac
+Q +aa0703e5cef0c61bec965d4c88ee48bbc11c3649
+R f99a043c5d8ac4d72fc50b0745a12dd6
+T *branch * apple-increased-sorting-cost
+T *sym-apple-increased-sorting-cost *
+T -sym-apple-osx *
+U drh
+Z a2fb6a39b09ee759202942947acdb999
rScale = sqlite3LogEst((nOrderBy-nSorted)*100/nOrderBy) - 66;
rSortCost = nRow + rScale + 16;
+ /* For wide sorts (many payload columns) increase the sorting cost
+ ** to account for the additional I/O used by the external sorting
+ ** algorithm when it flushes PMAs to disk.
+ */
+ if( pWInfo->pDistinctSet
+ && pWInfo->pDistinctSet->nExpr>6
+ ){
+ rSortCost += sqlite3LogEst(pWInfo->pDistinctSet->nExpr) - 26;
+ }
+
/* Multiple by log(M) where M is the number of output rows.
** Use the LIMIT for M if it is smaller */
if( (pWInfo->wctrlFlags & WHERE_USE_LIMIT)!=0 && pWInfo->iLimit<nRow ){