/ Check-in [b05340fe]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Increase the default minimum PMA size for multi-threaded sorting from 10x the page size to 250x the page size. Provide the SQLITE_SORTER_PMASZ compile-time option to change this default.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b05340fe3cd5f1676a55023228dc8d1a92de5936
User & Date: drh 2014-12-09 14:42:49
Context
2014-12-09
15:12
Add the SQLITE_REVERSE_UNORDERED_SELECTS compile-time option that causes the "PRAGMA reverse_unordered_selects" setting to be on by default. check-in: 75a803e6 user: drh tags: trunk
15:01
Increase the default PMA size from 10 to 250 pages and provide the SQLITE_SORTER_PMASZ compile-time option to change this default. Add needed mutex call when clearing the KeyInfo cache in shared-cache mode. check-in: 6e2da589 user: drh tags: apple-osx
14:54
Merge the KeyInfo cache mutex fix from trunk. check-in: f0940c73 user: drh tags: sessions
14:42
Increase the default minimum PMA size for multi-threaded sorting from 10x the page size to 250x the page size. Provide the SQLITE_SORTER_PMASZ compile-time option to change this default. check-in: b05340fe user: drh tags: trunk
04:26
Fix harmless compiler warning. check-in: e97b7a8b user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbesort.c.

   446    446   **
   447    447   **   void *SRVAL(SorterRecord *p) { return (void*)&p[1]; }
   448    448   */
   449    449   #define SRVAL(p) ((void*)((SorterRecord*)(p) + 1))
   450    450   
   451    451   /* The minimum PMA size is set to this value multiplied by the database
   452    452   ** page size in bytes.  */
   453         -#define SORTER_MIN_WORKING 10
          453  +#ifndef SQLITE_SORTER_PMASZ
          454  +# define SQLITE_SORTER_PMASZ 250
          455  +#endif
   454    456   
   455    457   /* Maximum number of PMAs that a single MergeEngine can merge */
   456    458   #define SORTER_MAX_MERGE_COUNT 16
   457    459   
   458    460   static int vdbeIncrSwap(IncrMerger*);
   459    461   static void vdbeIncrFree(IncrMerger *);
   460    462   
................................................................................
   845    847       pSorter->db = db;
   846    848       for(i=0; i<pSorter->nTask; i++){
   847    849         SortSubtask *pTask = &pSorter->aTask[i];
   848    850         pTask->pSorter = pSorter;
   849    851       }
   850    852   
   851    853       if( !sqlite3TempInMemory(db) ){
   852         -      pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz;
          854  +      pSorter->mnPmaSize = SQLITE_SORTER_PMASZ * pgsz;
   853    855         mxCache = db->aDb[0].pSchema->cache_size;
   854         -      if( mxCache<SORTER_MIN_WORKING ) mxCache = SORTER_MIN_WORKING;
          856  +      if( mxCache<SQLITE_SORTER_PMASZ ) mxCache = SQLITE_SORTER_PMASZ;
   855    857         pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_MXPMASIZE);
   856    858   
   857    859         /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of
   858    860         ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary
   859    861         ** large heap allocations.
   860    862         */
   861    863         if( sqlite3GlobalConfig.pScratch==0 ){