pingcap/tidb
View on GitHubAccelerate FindColumn when table has huge number of columns
Open
#11,151 opened on Jul 9, 2019
help wantedtype/enhancementtype/performance
Description
Feature Request
Is your feature request related to a problem? Please describe:
FindCols(https://github.com/pingcap/tidb/blob/c8d1ff7ca66f6e98d2002c429addf5ba34fd0416/table/column.go#L87)FindColumn(https://github.com/pingcap/tidb/blob/873d9514bc94be8e76c30c863a85155eafaa468a/expression/schema.go#L111)
will be frequently called when build query plan or build insert value list.
now it uses linear search to find column info match target name....
when the table has limitation columns it works well...
but when table got many columns (e.g. 200+ columns), upper logic will find 200 columns to do linear search in 200 items.

Describe the feature you'd like:
maybe we should adaptively replace a linear search with another method when table has many columns