Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql/rowexec: recycle coveringSpans in batchedInvertedExprEvaluator
This commit updates batchedInvertedExprEvaluator to recycle the `[]invertedSpan` that it constructs in its init method, such that the same slice can be reused for each batch of rows in the `invertedJoiner`. Before this change, this heap allocations accounted for 5.51% of all heap allocations (by size, `alloc_space`) in a geospatial query of interest: ``` ----------------------------------------------------------+------------- 804MB 100% | github.com/cockroachdb/cockroach/pkg/sql/rowexec.(*invertedJoiner).readInput /go/src/github.com/cockroachdb/cockroach/pkg/sql/rowexec/inverted_joiner.go:418 804MB 5.51% 36.69% 804MB 5.51% | github.com/cockroachdb/cockroach/pkg/sql/rowexec.(*batchedInvertedExprEvaluator).init /go/src/github.com/cockroachdb/cockroach/pkg/sql/rowexec/inverted_expr_evaluator.go:407 ----------------------------------------------------------+------------- ``` When applied on top of #53181 and #53215, this results in a 0.4% speedup on the following geospatial query: ```sql SELECT Count(census.blkid), Count(subways.name) FROM nyc_census_blocks AS census JOIN nyc_subway_stations AS subways ON ST_Intersects(subways.geom, census.geom); ``` ``` name old ms new ms delta Test/postgis_geometry_tutorial/nyc 134 ±12% 133 ±12% -0.40% (p=0.006 n=976+979) ```
- Loading branch information