mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 01:39:21 +03:00
14b0de09e2
Summary: Our code to select changesets returns a result set that looks like this: ``` GEN|P1_ID GEN|P2_ID ``` Where `GEN` is the generation of the commit being selected and `PX_ID` are the IDs of its parents. If there are no parents, it'll look like: ``` GEN|NULL ``` However, this doesn't optimize very well on sqlite, and this query ends up taking several seconds even on fairly modest datasets, as SQLite produces a join table containing all changesets / csparents pairs before filtering them. This diff updates our logic to instead use a union query instead in order to do the selection in two blocks: first, we get the parents we care about out of the csparents table (which is fast), and separately, we get the one changeset we care about out of the changesets table. This is perhaps also a little easier to interpret as it avoids the special case on parents with no commits. Indeed, the dataset now always looks like: ``` GEN|NULL|NULL GEN|P1_ID|P1_SEQ GEN|P2_ID|P2_SEQ ``` On MySQL, this doesn't really seem to make a difference from a performance perspective. I'm guessing MySQL optimizes this more appropriately. Reviewed By: StanislavGlebik Differential Revision: D18573813 fbshipit-source-id: 940954bf067c429b8419b9b0f9ee799c2d06e8f1 |
||
---|---|---|
.. | ||
if | ||
schemas | ||
src |