Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Faster implementation of start_of_branch() using a CTE. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8736de8baad75d2630f96ef649bd3b85 |
User & Date: | drh 2022-03-08 13:08:07 |
Context
2022-03-08
| ||
20:47 | On file listing pages, sort files that have numbers as part of their name in numeric order. ... (check-in: 59dfca5e user: drh tags: trunk) | |
13:08 | Faster implementation of start_of_branch() using a CTE. ... (check-in: 8736de8b user: drh tags: trunk) | |
12:04 | Fix the case eType==1 (find the first check-in of the branch). ... (Closed-Leaf check-in: 5e34c998 user: danield tags: start-of-branch-cte) | |
01:07 | Timeline graph layout changes that strive to do better a communicating the merging and branching activity between multiple branches. ... (check-in: d1d7fce6 user: drh tags: trunk) | |
Changes
Changes to src/name.c.
︙ | ︙ | |||
155 156 157 158 159 160 161 | */ int start_of_branch(int rid, int eType){ Stmt q; int rc; int ans = rid; char *zBr = branch_of_rid(rid); db_prepare(&q, | > > | | | > > > > > > | | > > > | < < < | | < < > | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | */ int start_of_branch(int rid, int eType){ Stmt q; int rc; int ans = rid; char *zBr = branch_of_rid(rid); db_prepare(&q, "WITH RECURSIVE" " par(pid, ex, cnt) as (" " SELECT pid, EXISTS(SELECT 1 FROM tagxref" " WHERE tagid=%d AND tagtype>0" " AND value=%Q AND rid=plink.pid), 1" " FROM plink WHERE cid=%d AND isprim" " UNION ALL " " SELECT plink.pid, EXISTS(SELECT 1 FROM tagxref " " WHERE tagid=%d AND tagtype>0" " AND value=%Q AND rid=plink.pid)," " 1+par.cnt" " FROM plink, par" " WHERE cid=par.pid AND isprim AND par.ex " " LIMIT 100000 " " )" " SELECT pid FROM par WHERE ex>=%d ORDER BY cnt DESC LIMIT 1", TAG_BRANCH, zBr, ans, TAG_BRANCH, zBr, eType%2 ); fossil_free(zBr); rc = db_step(&q); if( rc==SQLITE_ROW ){ ans = db_column_int(&q, 0); } db_finalize(&q); if( eType==2 && ans>0 ){ zBr = branch_of_rid(ans); ans = compute_youngest_ancestor_in_branch(rid, zBr); fossil_free(zBr); } return ans; |
︙ | ︙ |