# 规则:
#   Item: 规则代号
#   Name: 规则名称
#   Summary: 规则摘要
#   Close: 规则开关，1为开，0为关，其他值默认关闭
#   Level: 规则告警等级
#   Threshold: 一个可定义的阈值，当规则需要定义阈值时可修改使用，使用时可以通过GetThresholdString与GetThreshold
#   CheckFunc: 规则对应函数名
#   Case: SQL样例

RuleCreate001:
  Item: "CREATE.001"
  Name: "injection check character set"
  Summary: "表必须指定utf8mb4字符集若指定collate则必须为utf8mb4_bin"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableCharset"
  Case:

RuleCreate002:
  Item: "CREATE.002"
  Name: "injection check table comment"
  Summary: "表必须要有注释"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableComment"
  Case:

RuleCreate003:
  Item: "CREATE.003"
  Name: "injection check table primary key"
  Summary: "表必须要有主键"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableIndex"
  Case:

RuleCreate004:
  Item: "CREATE.004"
  Name: "injection check column comment"
  Summary: "列必须要有注释"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleColCommentCheck"
  Case:

RuleCreate005:
  Item: "CREATE.005"
  Name: "injection check unique index name"
  Summary: "Unique索引必须要以uniq_为前缀，比如uniq_ab"
  Close: 1
  Level: 1
  Threshold: "uniq_"
  CheckFunc: "RuleCreateTableUniqIndex"
  Case:

RuleCreate006:
  Item: "CREATE.006"
  Name: "injection check index name"
  Summary: "普通索引必须要以idx_为前缀，比如idx_ab"
  Close: 1
  Level: 1
  Threshold: "idx_"
  CheckFunc: "RuleCreateTableNormalIndex"
  Case:

RuleCreate007:
  Item: "CREATE.007"
  Name: "injection check index column amount"
  Summary: "索引的列数不能超过3个"
  Close: 1
  Level: 1
  Threshold: 3
  CheckFunc: "RuleCreateTableIndexColNum"
  Case: "CREATE TABLE sc(Sno varchar(20) NOT NULL,	Cno varchar(10) NOT NULL,	Grade int(11) DEFAULT NULL,	PRIMARY KEY (Sno,Cno), 	FOREIGN KEY (Sno) REFERENCES student.Sno,	FOREIGN KEY (Cno) REFERENCES course (Cno,Sno)) ENGINE=InnoDB DEFAULT CHARSET=utf8;"

RuleCreate008:
  Item: "CREATE.008"
  Name: "injection check index amount"
  Summary: "建表时最多有5个索引"
  Close: 1
  Level: 1
  Threshold: 5
  CheckFunc: "RuleCreateTableIndexNum"
  Case:

RuleCreate009:
  Item: "CREATE.009"
  Name: "injection check repeat index"
  Summary: "不能有重复的索引，包括(索引名不同，字段相同；冗余索引，如(a)(ab))"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableDupIndex"
  Case:

RuleCreate010:
  Item: "CREATE.010"
  Name: "injection check column not null"
  Summary: "每个列使用not null，text字段除外；text不能有默认值"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableNotNullValue"
  Case:

RuleCreate011:
  Item: "CREATE.011"
  Name: "injection check column character set"
  Summary: "不能设置列的字符集"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableSetColCharset"
  Case:

RuleCreate012:
  Item: "CREATE.012"
  Name: "injection check joint index order"
  Summary: "如果是联合索引，时间字段，不能放在第一列"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableCoIndexOrder"
  Case:

RuleCreate013:
  Item: "CREATE.013"
  Name: "injection check joint index exclude"
  Summary: "联合索引，不能包含主键或者唯一索引列"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableCoIndexEx"
  Case:

RuleCreate014:
  Item: "CREATE.014"
  Name: "injection check index column character amount"
  Summary: "索引列字符量>128拦截"
  Close: 1
  Level: 1
  Threshold: 128
  CheckFunc: "RuleCreateTableIndexLen"
  Case:

RuleCreate015:
  Item: "CREATE.015"
  Name: "injection check text column amount"
  Summary: "表text字段不能超过3个"
  Close: 1
  Level: 1
  Threshold: 3
  CheckFunc: "RuleCreateTableTextColNum"
  Case:

RuleCreate016:
  Item: "CREATE.016"
  Name: "injection can't use mysql key words as column name"
  Summary: "不能使用mysql关键字、保留字作为列名"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableNotUseKeyWorld"
  Case:

RuleCreate017:
  Item: "CREATE.017"
  Name: "injection can't use int as primary key bigInt expect"
  Summary: "不能使用int作为主键，请换成bigInt"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleNotUseIntAsPrimaryKey"
  Case:
  #改表时同"样适用

RuleCreate018:
  Item: "CREATE.018"
  Name: "injection varchar length no more than 1024"
  Summary: "varchar的长度不能超过1024，建议使用text"
  Close: 1
  Level: 1
  Threshold: 1024
  CheckFunc: "RuleVarcharLengthLimit"
  Case:

RuleCreate019:
  Item: "CREATE.019"
  Name: "auto increment start value limit 1w"
  Summary: "自增主键起始值不能超过10000"
  Close: 1
  Level: 1
  Threshold: 10000
  CheckFunc: "RuleAutoIncrementLimit"
  Case:

RuleCreate020:
  Item: "CREATE.020"
  Name: "create a table with type DATE or TIMESTAMP"
  Summary: "建表没有date或timestamp类型的字段,一般需要配上日期字段"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableWithOutDate"
  Case:

RuleCreate021:
  Item: "CREATE.021"
  Name: "create too many column"
  Summary: "表字段数量过多，往往会导致一个数据块存放的行数越少，因此读取数据时IO发生次数越多，超宽表易于浪费空间，且增加数据库中行链接的情况出现，对系统性能有较大隐患"
  Close: 1
  Level: 1
  Threshold: 64
  CheckFunc: "RuleCreateTooManyColumn"
  Case:

RuleCreate022:
  Item: "CREATE.022"
  Name: "Do not use foreign key"
  Summary: "建表时不建议创建外键，外键对数据库性能有较大负面影响，也容易导致大面积死锁"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableNotUseForeignKey"
  Case:

RuleCreate023:
  Item: "CREATE.023"
  Name: "Use Partitioning"
  Summary: "SQL使用分区表，在维护上会增大开销，需要特别谨慎"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateTableUsePartitioning"
  Case:

RuleCreate024:
  Item: "CREATE.024"
  Name: "The Sequence Without Cache"
  Summary: "SQL 语句创建无缓存序列"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleCreateSequenceNoCache"
  Case:

RuleCreate029:
  Item: "CREATE.029"
  Name: "Too many fields in a single table using Text type"
  Summary: "单表使用Text类型的字段过多"
  Close: 1
  Level: 2
  Threshold: 1
  CheckFunc: "RuleColUseText"
  Case: "create table tablename(id text(32),id2 text(12));"

RuleCreate030:
  Item: "CREATE.030"
  Name: "The field uses unsigned bigint"
  Summary: "字段使用了unsigned bigint"
  Close: 1
  Level: 1
  Threshold: 1
  CheckFunc: "RuleColUseUsignInt"
  Case:  "ALTER TABLE db_injection_task ADD COLUMN `device` BIGINT UNSIGNED NOT NULL COMMENT '设备';"

RuleCreate031:
  Item: "CREATE.031"
  Name: "Create table has more than one autoincrement column"
  Summary: "create table超过一个自增列"
  Close: 1
  Level: 1
  Threshold: 1
  CheckFunc: "RuleSQLMultiAutoIncr"
  Case: "create table tablename(id int auto_increment primary key,id2 int auto_increment primary key); "

RuleAlter001:
  Item: "ALTER.001"
  Name: "injection check drop column"
  Summary: "禁止删列操作"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterTableDropColumn"
  Case:

RuleAlter002:
  Item: "ALTER.002"
  Name: "injection check drop or truncate table"
  Summary: "禁止drop、truncate表操作"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterTableDrop"
  Case:
  #这个规"则，只检查添加索引的场景。（后续可能会有删除索引的场景）
 
RuleAlter003:
  Item: "ALTER.003"
  Name: "injection affect rows"
  Summary: "影响行数超过3000"
  Close: 1
  Level: 1
  Threshold: 3000
  CheckFunc: "RuleAffectRows"
  Case:

RuleAlter004:
  Item: "ALTER.004"
  Name: "injection don't add multi index or column once"
  Summary: "不支持同时创建多个索引或者列"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleBanAddMulti"
  Case:
  #跟上一条rule加上关联，认为一次修改仅有一个变动的列
 
RuleAlter005:
  Item: "ALTER.005"
  Name: "injection unsupported modify type"
  Summary: "不支持的类型更改"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleUnsupportedType"
  Case:

RuleAlter006:
  Item: "ALTER.006"
  Name: "DDL Do not use foreign key"
  Summary: "使用sql给表增加外键，外键带来的性能开销远远大于带来的一致性维护的便利"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterUseForeignKey"
  Case: "ALTER TABLE t1 ADD FOREIGN KEY (Id) REFERENCES t2(t_Id)"

RuleAlter010:
  Item: "ALTER.010"
  Name: "Table adds column char type field"
  Summary: "表新增列char类型字段"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAddCharCol"
  Case: "ALTER TABLE db_injection_task ADD COLUMN `device` CHAR(32) NOT NULL COMMENT '设备';"

RuleAlter012:
  Item: "ALTER.012"
  Name: "Use complex data types"
  Summary: "检测到复杂的数据类型，尽可能使用简单数据类型"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleSQLUseBlob"
  Case: "ALTER TABLE db_injection_task ADD COLUMN `device` text(32) NOT NULL COMMENT '设备';"

RuleAlter013:
  Item: "ALTER.013"
  Name: "Index name is required to create an index"
  Summary: "创建索引必须要有索引名称"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDdlIdxNoname"
  Case: "ALTER TABLE  table_name  ADD INDEX  ( `func`,`gene`,`genedetail`,`genedetail2`); "

RuleAlter014:
  Item: "ALTER.014"
  Name: "The column uses a varchar type that is too small"
  Summary: "列使用长度过小的varchar"
  Close: 1
  Level: 1
  Threshold: 5
  CheckFunc: "RuleVarcharSmall"
  Case: "ALTER TABLE db_injection_task ADD COLUMN `device` VARCHAR(4) NOT NULL COMMENT 'qwe';"

RuleAlter016:
  Item: "ALTER.016"
  Name: "The character set is specified on the altertable column"
  Summary: "不推荐AlterTable改变字符集"
  Close: 1
  Level: 1
  Threshold: 1
  CheckFunc: "RuleDDLUseCharset"
  Case: "alter table tweets change WeiboContent WeiboContent varchar(350) character set utf8mb4 collate utf8mb4_unicode_ci;"

RuleAlter020:
  Item: "ALTER.020"
  Name: "The same table is connected twice"
  Summary: "相同的表在 FROM 子句中至少出现两次，可以简化为对该表的单次访问。"
  Close: 1
  Level: 2
  Threshold: 
  CheckFunc: "RuleDdlTabMulJoin"
  Case: "select tb1.col from (tb1, tb2) join tb2 on tb1.id=tb.id where tb1.id=1"

RuleAlter021:
  Item: "ALTER.021"
  Name: "It is forbidden to update, delete, and insert data on the view."
  Summary: "禁止对视图进行更新、删除、插入数据操作。"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterViewUpdate"
  Case: "INSERT INTO view1 (id) VALUES (15);delete from view1 where id =1;"
  Case2: "update view1 set filesize = 1 where id = 2;"

RuleAlter022:
  Item: "ALTER.022"
  Name: "Disallow subqueries on the view"
  Summary: "禁止在视图上进行子查询"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterViewSubquery"
  Case: "select id from view1 where id in (select id from view1 where id = 1);"
  Case2: "select id from view1 where id >ANY(select id from view);"

RuleAlter023:
  Item: "ALTER.023"
  Name: "Prohibit JOIN operations between views."
  Summary: "禁止在视图之间进行JOIN操作。"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterViewJoin"
  Case: "select id ,projectid from view1 inner join view2 on view1.id = view2.id;"
  Case2: "delete id from projectfile left join view1 on projectfile.id = view1.id where projectfile.id = 1;"

RuleDml001:
  Item: "DML.001"
  Name: "injection check where"
  Summary: "必须有where条件"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDMLTableNoWhere"
  Case:

RuleDml002:
  Item: "DML.002"
  Name: "injection check always true"
  Summary: "永远为真的比较条件"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleMeaninglessWhere"
  Case:

RuleDml003:
  Item: "DML.003"
  Name: "injection check use joined table when update"
  Summary: "不建议使用联表删除或更新"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleMultiDeleteUpdate"
  Case:

RuleDml004:
  Item: "DML.004"
  Name: "injection check insert column def"
  Summary: "必须指定插入列表"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleInsertColDef"
  Case:

RuleDml005:
  Item: "DML.005"
  Name: "injection check insert value amount"
  Summary: "插入列列表与值列表个数不相同"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleInsertColValueEqual"
  Case:

RuleDml006:
  Item: "DML.006"
  Name: "injection check table exist"
  Summary: "目标库中表不存在"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterTableExist"
  Case:

RuleDml007:
  Item: "DML.007"
  Name: "injection check column exist"
  Summary: "目标库中表的字段不存在"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleAlterTableColumnExist"
  Case:

RuleDml008:
  Item: "DML.008"
  Name: "injection index match "
  Summary: "删改数据索引不完全匹配"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlIndexMatch"
  Case:

RuleDml009:
  Item: "DML.009"
  Name: "injection affect no more than 100"
  Summary: "删改数据影响行数超过100"
  Close: 1
  Level: 1
  Threshold: 100
  CheckFunc: "RuleDmlNoMoreThan100"
  Case:

RuleDml029:
  Item: "DML.029"
  Name: " add Calculation to the filter column after where"
  Summary: "SQL中where后的过滤列上加函数、运算将导致无法利用该字段上的索引"
  Close: 1
  Level: 2
  Threshold: 0
  CheckFunc: "RuleDmlSQLColCompute"
  Case: "select * from  data_market.mkt_order_by_month_userid_type where  concat(year_id,'-',if(month_id<10,'0',''),month_id)='2011-09';"
  Case2: "SELECT id from projectfile where (id+2) = to_number(id);"

RuleDml010:
  Item: "DML.010"
  Name: "Limit corresponds to excessive offset"
  Summary: "Limit对应的偏移量过大，sql语句性能可能存在性能瓶颈"
  Close: 1
  Level: 1
  Threshold: 1000
  CheckFunc: "RuleDmlLimitOversized"
  Case: "select * from table_a limit 1; select * from table_a limit 1,2 ;  select * from table_a limit 1 offset 2 ; "

RuleDml011:
  Item: "DML.011"
  Name: "Having Clause To Where Clause"
  Summary: "SQL中使用having，能写在where限定的条件就不要去having限定"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlHavingClause"
  Case: "SELECT a.a_id,count(a.a_id) FROM table_a a where a = '1' GROUP BY a.a_id HAVING a.a_id <> '2' AND a.a_id <> '3' order by a.a_id "

RuleDml012:
  Item: "DML.012"
  Name: "Index does not take effect when use or"
  Summary: "where子句中使用or来连接条件，引擎将放弃使用索引而进行全表扫描"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlUseOrIndexNotTakeEffect"
  Case: "select * from table_a limit 1; select * from table_a limit 1,2 ;  select * from table_a limit 1 offset 2 ; "

RuleDml013:
  Item: "DML.013"
  Name: "Index does not take effect"
  Summary: "SQL中使用!=或者<>，引擎放弃使用索引而进行全表扫描"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlIndexNotTakeEffect"
  Case: "select * from table_a limit 1; select * from table_a limit 1,2 ;  select * from table_a limit 1 offset 2 ; "

RuleDml014:
  Item: "DML.014"
  Name: "Prohibit CROSS JOIN operations"
  Summary: "存在全连接cross join"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlProhibitCrossJoin"
  Case: "select * from user_role ur cross join user u "

RuleDml015:
  Item: "DML.015"
  Name: "order by fields exceeds limit "
  Summary: "order by 字段超过限制"
  Close: 1
  Level: 1
  Threshold: 1
  CheckFunc: "RuleDmlOrderByFieldsExceedsLimit"
  Case: "select userid,roleid from user_role order by userid,roleid "

RuleDml016:
  Item: "DML.016"
  Name: "Subqueries with NOT IN or NOT LIKE"
  Summary: "存在not in ，not like的子查询，性能可能存在瓶颈"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlSubqueriesWithNotInOrNotLike"
  Case: "select userid,roleid from user_role where userid not in (1,2,3,4) ; select userid,roleid from user_role where userid not likt '1%'"

RuleDml017:
  Item: "DML.017"
  Name: "SQL with UNION"
  Summary: "SQL中出现union,minus,intersect"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlWithUnion"
  Case: "select userid,roleid from user_role where userid not in (1,2,3,4) union select userid,roleid from user_role where userid not like '1%'"

RuleDml018:
  Item: "DML.018"
  Name: "Subqueries in WHERE Clause"
  Summary: "查询语句中 where 段出现子查询，有一定性能隐患"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlSubqueriesInWhereClause"
  Case: ""

RuleDml019:
  Item: "DML.019"
  Name: "Subqueries in FROM Clause"
  Summary: "查询语句 from 段出现子查询，有一定性能风险"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlSubqueriesInFromClause"
  Case: ""

RuleDml020:
  Item: "DML.020"
  Name: "Deleting Data from Multiple Tables"
  Summary: "SQL使用多表关联delete操作，超过一定数量时，表的连接性能会下降严重"
  Close: 1
  Level: 1
  Threshold: 2
  CheckFunc: "RuleDmlDeletDataFromMultipleTables"
  Case: "DELETE t1,t2 from t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t1.id=25 "

RuleDml021:
  Item: "DML.021"
  Name: "Update from Multiple Tables"
  Summary: "过多表关联update操作,导致SQL语句性能极差，且更新锁表时间加长，大幅降低系统并发性"
  Close: 1
  Level: 1
  Threshold: 2
  CheckFunc: "RuleDmlUpdateFromMultipleTables"
  Case: "UPDATE student s , class c SET s.class_name='test00',c.stu_name='test00' WHERE s.class_id = c.id "

RuleDml030:
  Item: "DML.030"
  Name: "Select without where"
  Summary: "查询条件缺少where条件，将查询全表的数据"
  Close: 1
  Level: 2
  Threshold: 031
  CheckFunc: "RuleDmlSeleNoWhere"
  Case: "select * from projectfile;"
  Case1: "insert into projectfile (id, projectid) select projectfile.id ,projectfile2.projectid from projectfile ;"
  
RuleDml031:
  Item: "DML.031"
  Name: "DML use OrderBy"
  Summary: "DML中使用order by子句，通常没有必要对更新/删除项排序"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleDmlUseOrderBy"
  Case: "update cms_user set age=age+10 order by id desc limit 3;"

RuleDml033:
  Item: "DML.033"
  Name: "SQL use Count(*)、Count(col)"
  Summary: "COUNT(字段)相对COUNT(*)可能性能会更差"
  Close: 1
  Level: 2
  Threshold: 0
  CheckFunc: "RuleSQLCountCol"
  Case: "SELECT COUNT(col_name) FROM table_name;"

RuleDml037:
  Item: "DML.037"
  Name: " SQL use Fomat Query"
  Summary: "%前导查询将导致查询无法使用索引，产生性能问题"
  Close: 1
  Level: 1
  Threshold: 0
  CheckFunc: "RuleSQLFomatQuery"
  Case: "select count(*) from db_injection_cluster where name like '%t%';"

RuleCreate321:
  Item: "CREATE.321"
  Name: "Primary Key use pk_"
  Summary: "主键必须要以pk_为前缀，比如pk_tablename"
  Close: 1
  Level: 1
  Threshold: "pk_"
  CheckFunc: "RuleCreateTablePK"
  Case:

RuleCreate322:
  Item: "CREATE.322"
  Name: "Foreign Key use fk_"
  Summary: "外键必须要以fk_为前缀，比如fk_tablename"
  Close: 1
  Level: 1
  Threshold: "fk_"
  CheckFunc: "RuleCreateTableFK"
  Case:

RuleCreate034:
  Item: "CREATE.034"
  Name: "injection check column use ENUM "
  Summary: "不建议使用ENUM数据类型，建议使用tinyint代替，避免发生混淆"
  Close: 1
  Level: 1
  Threshold:
  CheckFunc: "RuleCreateTableUseEnum"
  Case: "alter table test1 add column user ENUM('women','men','N') NOT NULL DEFAULT 'N' COMMENT '用户性别';"

RulePln001:
  Item: "PLN.001"
  Name: "Index range scan in plan"
  Summary: "执行计划中出现了索引范围扫描,对索引的扫描开始于某一点，返回匹配值域的行，常见于between、<、>等的查询"
  Close: 1
  Level: 2
  Threshold:
  CheckFunc: "RulePlnIdxRangeSan"
  Case:

RulePln002:
  Item: "PLN.002"
  Name: "Index Full scan in plan"
  Summary: "执行计划中出现了全索引扫描,可能存在大量IO消耗"
  Close: 1
  Level: 2
  Threshold:
  CheckFunc: "RulePlnIdxFullSan"
  Case:

RulePln004:
  Item: "PLN.004"
  Name: "Full table scan in plan"
  Summary: "执行计划中出现了全表扫描"
  Close: 1
  Level: 2
  Threshold:
  CheckFunc: "RulePlnTableAll"
  Case:



RulePln005:
  Item: "PLN.005"
  Name: "Index column not used in where condition"
  Summary: "where条件中未使用索引列或索引未生效"
  Close: 1
  Level: 1
  Threshold:
  CheckFunc: "RulePlnWhereNoIdxCol"
  Case: "select id from projectfile where filesize > 1; "

RulePln006:
  Item: "PLN.006"
  Name: "SQL produces Cartesian product, which leads to poor performance"
  Summary: "SQL产生笛卡尔积，SQL性能极差"
  Close: 1
  Level: 2
  Threshold: 
  CheckFunc: "RulePlnCartesian"
  Case: "select projectfile.id,projectfile2.filename from projectfile cross join projectfile2 where projectfile.id =1 and projectfile2.id =2;"


RulePushdown001:
  Item: "PUSHDOWN.001"
  Name: "Predicates that already supported by storage layers are not pushed down"
  Summary: "存储层已支持的谓词没有下推"
  Close: 1
  Level: 1
  Threshold:
  CheckFunc: "RulePushdownNotSupportedPredicates"
  Case: "select id from t where substring('123', a, 1) = '1';"

RulePushdown002:
  Item: "PUSHDOWN.002"
  Name: "Predicates of inner tables on the outer join can't be pushed down"
  Summary: "外连接中内表上的谓词不能下推"
  Close: 1
  Level: 1
  Threshold:
  CheckFunc: "RulePushdownToJoinOperator"
  Case: "select t.id from t left join s on t.a = s.a where s.a is null;"

RulePushdown003:
  Item: "PUSHDOWN.003"
  Name: "The predicates which contain user variables cannot be pushed down"
  Summary: "谓词中包含用户变量不能下推"
  Close: 1
  Level: 1
  Threshold:
  CheckFunc: "RulePushdownWithUserVaribales"
  Case: " select id from t where a < @a;"