为什么查询需要更多时间来执行。

Why query taking more time to execute.

当我执行删除查询时,需要更多的时间来执行。 我正在从 csv 文件中读取参数并使用参数从数据库中删除数据。 我的删除查询是,

delete_query = 'delete from app_outage_dfr_correlation_report_exclusions where start_time= %s AND stop_time= %s AND gil_site_id = %s AND total_time_in_mins = %s;'
args = (start_time,stop_time,gil_site_id,total_time_in_mins,)
cursor.execute(delete_query,args)

当我检查 cProfile 时,它​​显示以下结果。

1/8    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
       46    0.000    0.000    0.000    0.000 {method 'lower' of 'str' objects}
        1    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
       13    0.000    0.000    0.000    0.000 {method 'match' of '_sre.SRE_Pattern' objects}
        4    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
        1   11.135   11.135   11.135   11.135 {method 'query' of '_mysql.connection' objects}
        1    0.000    0.000    0.000    0.000 {method 'release' of 'thread.lock' objects}
       27    0.000    0.000    0.000    0.000 {method 'remove' of 'list' objects}
        9    0.000    0.000    0.000    0.000 {method 'remove' of 'set' objects}
       66    0.000    0.000    0.000    0.000 {method 'replace' of 'str' objects}
        3    0.000    0.000    0.000    0.000 {method 'setter' of 'property' objects}

谁能告诉我为什么执行需要更多时间。谢谢。

尝试使用 EXPLAIN SQL 语句检查您的查询,也许您的 table 确实 ,并且查询需要很长时间才能执行。