Fossil

Check-in [60debc7ed7]
Login

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

Overview
Comment:Fix the query in the compute_youngest_ancestor_in_branch() routine so that it has an ORDER BY to make it safe. The new order-by-subquery optimization in SQLite turns that ORDER BY into a no-op, so there is no performance impact.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 60debc7ed76b9d8fc0aa9ce1be6793cbb67609c2b1709c39c299249c81b5b306
User & Date: drh 2024-08-16 19:24:27.474
Context
2024-08-16
19:28
Make sure Fossil is run with a version of SQLite that include the order-by-subquery optimization, to avoid a performance problem. check-in: 668fefe796 user: drh tags: trunk
19:24
Fix the query in the compute_youngest_ancestor_in_branch() routine so that it has an ORDER BY to make it safe. The new order-by-subquery optimization in SQLite turns that ORDER BY into a no-op, so there is no performance impact. check-in: 60debc7ed7 user: drh tags: trunk
19:06
Update the built-in SQLite to the latest trunk version that includes the order-by-subquery optimization. check-in: a8aaed4216 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/descendants.c.
247
248
249
250
251
252
253

254
255
256
257
258
259
260
    "       AND event.objid=plink.pid"
    "     ORDER BY mtime DESC"
    "  )"
    "  SELECT ancestor.rid FROM ancestor"
    "   WHERE EXISTS(SELECT 1 FROM tagxref"
                    " WHERE tagid=%d AND tagxref.rid=+ancestor.rid"
                    "   AND value=%Q AND tagtype>0)"

    "  LIMIT 1",
    rid, rid, TAG_BRANCH, zBranch
  );
}

/*
** Compute all direct ancestors (merge ancestors do not count)







>







247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
    "       AND event.objid=plink.pid"
    "     ORDER BY mtime DESC"
    "  )"
    "  SELECT ancestor.rid FROM ancestor"
    "   WHERE EXISTS(SELECT 1 FROM tagxref"
                    " WHERE tagid=%d AND tagxref.rid=+ancestor.rid"
                    "   AND value=%Q AND tagtype>0)"
    "  ORDER BY mtime DESC"
    "  LIMIT 1",
    rid, rid, TAG_BRANCH, zBranch
  );
}

/*
** Compute all direct ancestors (merge ancestors do not count)