* create_incremental_sort_path * Creates a pathnode that represents performing an incremental sort. * * 'rel' is the parent relation associated with the result * 'subpath' is the path representing the source of data * 'pathkeys' represents the desired sort order * 'presorted_keys' is the number of keys by which the input path is * already sorted * 'limit_tuples' is the estimated bound o
| 4830 | * or -1 if no LIMIT or couldn't estimate |
| 4831 | */ |
| 4832 | IncrementalSortPath * |
| 4833 | create_incremental_sort_path(PlannerInfo *root, |
| 4834 | RelOptInfo *rel, |
| 4835 | Path *subpath, |
| 4836 | List *pathkeys, |
| 4837 | int presorted_keys, |
| 4838 | double limit_tuples) |
| 4839 | { |
| 4840 | IncrementalSortPath *sort = makeNode(IncrementalSortPath); |
| 4841 | SortPath *pathnode = &sort->spath; |
| 4842 | |
| 4843 | pathnode->path.pathtype = T_IncrementalSort; |
| 4844 | pathnode->path.parent = rel; |
| 4845 | /* Sort doesn't project, so use source path's pathtarget */ |
| 4846 | pathnode->path.pathtarget = subpath->pathtarget; |
| 4847 | /* For now, assume we are above any joins, so no parameterization */ |
| 4848 | pathnode->path.param_info = NULL; |
| 4849 | pathnode->path.parallel_aware = false; |
| 4850 | pathnode->path.parallel_safe = rel->consider_parallel && |
| 4851 | subpath->parallel_safe; |
| 4852 | pathnode->path.parallel_workers = subpath->parallel_workers; |
| 4853 | pathnode->path.pathkeys = pathkeys; |
| 4854 | |
| 4855 | pathnode->subpath = subpath; |
| 4856 | pathnode->path.locus = subpath->locus; |
| 4857 | |
| 4858 | cost_incremental_sort(&pathnode->path, |
| 4859 | root, pathkeys, presorted_keys, |
| 4860 | subpath->startup_cost, |
| 4861 | subpath->total_cost, |
| 4862 | subpath->rows, |
| 4863 | subpath->pathtarget->width, |
| 4864 | 0.0, /* XXX comparison_cost shouldn't be 0? */ |
| 4865 | work_mem, limit_tuples); |
| 4866 | |
| 4867 | sort->nPresortedCols = presorted_keys; |
| 4868 | |
| 4869 | return sort; |
| 4870 | } |
| 4871 | |
| 4872 | /* |
| 4873 | * create_sort_path |
no test coverage detected