Fossil

Check-in [78e10da0e6]
Login

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

Overview
Comment:Improve the performance of rebuild by using max(rid) instead of count(*) as a good approximation for the amount of work to be done.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 78e10da0e6513b25daab7c578762e7832fa2e01f
User & Date: drh 2011-10-31 11:46:15.653
Context
2011-10-31
17:54
Fix a potential division-by-zero in the file browser. ... (check-in: 4d408219bd user: drh tags: trunk)
11:46
Improve the performance of rebuild by using max(rid) instead of count(*) as a good approximation for the amount of work to be done. ... (check-in: 78e10da0e6 user: drh tags: trunk)
2011-10-29
19:29
Update the built-in SQLite to the 3.7.9 release candidate. ... (check-in: 326979358d user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/rebuild.c.
368
369
370
371
372
373
374




375
376
377
378
379
380
381
382
  db_multi_exec(
     "DELETE FROM unclustered"
     " WHERE rid IN (SELECT rid FROM shun JOIN blob USING(uuid))"
  );
  db_multi_exec(
    "DELETE FROM config WHERE name IN ('remote-code', 'remote-maxid')"
  );




  totalSize = db_int(0, "SELECT count(*) FROM blob");
  incrSize = totalSize/100;
  totalSize += incrSize*2;
  db_prepare(&s,
     "SELECT rid, size FROM blob /*scan*/"
     " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
     "   AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)"
  );







>
>
>
>
|







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
  db_multi_exec(
     "DELETE FROM unclustered"
     " WHERE rid IN (SELECT rid FROM shun JOIN blob USING(uuid))"
  );
  db_multi_exec(
    "DELETE FROM config WHERE name IN ('remote-code', 'remote-maxid')"
  );

  /* The following should be count(*) instead of max(rid). max(rid) is
  ** an adequate approximation, however, and is much faster for large
  ** repositories. */
  totalSize = db_int(0, "SELECT max(rid) FROM blob");
  incrSize = totalSize/100;
  totalSize += incrSize*2;
  db_prepare(&s,
     "SELECT rid, size FROM blob /*scan*/"
     " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
     "   AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)"
  );