acelyc111 opened a new issue #4928: URL: https://github.com/apache/incubator-doris/issues/4928
**Is your feature request related to a problem? Please describe.** Suppose there is a table: ``` CREATE TABLE `test_table3` ( `key_int` int(11) NULL COMMENT "", `key_varchar` varchar(16) NULL COMMENT "", `val_int` int(11) NULL COMMENT "" ) ENGINE=OLAP DUPLICATE KEY(`key_int`, `key_varchar`) COMMENT "OLAP" DISTRIBUTED BY HASH(`key_int`) BUCKETS 1 PROPERTIES ( "replication_num" = "1", "in_memory" = "false", "storage_format" = "V2" ); ``` And a query like: ``` select count(1) from test_table3 where key_int = 1 and key_varchar in ('1','2','3','4','5','6','7','8','9'); ``` The scanner on BE may do the IN predicate at first, it's more costly than EQ predicate. **Describe the solution you'd like** We can sort conditions based on cost, roughly: - unary operators (IS) is cheaper than binary operators(EQ,NE,LT,LE,GT,GE) - binary operators are cheaper than IN/NOT IN And also different column types have different cost: - INT is cheaper than CHAR or VARCHAR basically - shorter INT or VARCHAR is cheaper than longer one We can sort conditions base on cost before do actual scan. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org