Get the App
SLTechnology News&Howtos  ›  Database  › 

Sqladvisor: Invalid parameter number solution

Shulou Source: shulou.com Published: 2022-06-01 21:21:02 10月03日 Update

An error was reported when installing and using Meituan net sqladvisor:

. / sqladvisor-h xxx-P 3306-u admin-p 'xxx'-d sql_audit-Q "SELECT FROM product_spu_modify where CreateTime > '2018-07-29 14 15 admin 46;"-v 1

2018-07-30 17:51:19 10008 [Note] step 1: optimize the SQL:select AS * from sql_audit.product_spu_modify where obtained after SQL parsing (CreateTime > '2018-07-29 14 SQL:select AS 15 from sql_audit.product_spu_modify where 46')

2018-07-30 17:51:19 10008 [Note] step 2: start parsing the conditions in the where: (CreateTime > '2018-07-29 14 CreateTime 15 CreateTime 46')

2018-07-30 17:51:19 10008 [Note] step 3: end of SQLAdvisor! Error log: Invalid parameter number

Since it is difficult to troubleshoot without a detailed error log, but it must be dependent on the package, this package must have something to do with passing in the MYSQL parameter. After many aspects of testing, the problem that has plagued me for a week has been solved. The problem lies in the php-mysql extension installed by centos, which will appear above SQLAdvisor end! Error log: Invalid parameter numbered error logs! Replace php-mysql with php-mysqlnd. The problem can be solved.

Yum install php-mysqlnd

2018-08-02 14:57:12 5294 [Note] step 5: field CreateTime is not a primary key. Table name: product_spu_modify

2018-08-02 14:57:12 5294 [Note] step 6: start verifying that the field CreateTime is the primary key. Table name: product_spu_modify

2018-08-02 14:57:12 5294 [Note] show index from product_spu_modify where Key_name = 'PRIMARY' and Column_name =' CreateTime' and Seq_in_index = 1

2018-08-02 14:57:12 5294 [Note] step 7: field CreateTime is not a primary key. Table name: product_spu_modify

2018-08-02 14:57:12 5294 [Note] step 8: start verifying that the relevant index already exists in the table. Table name: product_spu_modify, field name: CreateTime, position in the index: 1

2018-08-02 14:57:12 5294 [Note] show index from product_spu_modify where Column_name = 'CreateTime' and Seq_in_index = 1

2018-08-02 14:57:12 5294 [Note] step 9: start the output table product_spu_modify index optimization recommendations:

2018-08-02 14:57:12 5294 [Note] Create_Index_SQL:alter table product_spu_modify add index idx_CreateTime (CreateTime)

2018-08-02 14:57:12 5294 [Note] step 10: end of SQLAdvisor!

Tags: Fields questions logs indexes errors affirmation validation location parameters multifaceted suggestions times conditions related tests output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Redmi Huawei NVidia Xiaomi