SQL Azure ELMAH删除语句需要很长时间

时间:2016-07-22 14:12:49

标签: sql-server azure elmah

我们有一个每周清理工作,删除超过3个月的ELMAH条目,但是由于语句需要很长时间,因此工作会保持计时。该表没有触发器,没有FK和2个非聚集索引。

DELETE FROM ELMAH_Error where [Application] = 'XXXXX' AND TimeUtc < CONVERT(datetime, '20160422')

在本地,删除13k记录大约需要9秒,在Azure中删除当前15分钟并计数的相同记录数。该实例是一个S3,因此在性能方面不是最好的或最差的,并且它在更复杂的查询上表现得非常好。

这是否真的是预期的删除性能,或者我可以采取哪些措施来改进它?

根据评论中的请求,我正在添加会话信息:

session_id  request_id  start_time  status  command sql_handle  statement_start_offset  statement_end_offset    plan_handle database_id user_id connection_id   blocking_session_id wait_type   wait_time   last_wait_type  wait_resource   open_transaction_count  open_resultset_count    transaction_id  context_info    percent_complete    estimated_completion_time   cpu_time    total_elapsed_time  scheduler_id    task_address    reads   writes  logical_reads   text_size   language    date_format date_first  quoted_identifier   arithabort  ansi_null_dflt_on   ansi_defaults   ansi_warnings   ansi_padding    ansi_nulls  concat_null_yields_null transaction_isolation_level lock_timeout    deadlock_priority   row_count   prev_error  nest_level  granted_query_memory    executing_managed_code  group_id    query_hash  query_plan_hash statement_sql_handle    statement_context_id    dop parallel_worker_count   external_script_request_id
64  0   2016-07-22 16:00:25.280 suspended   DELETE  0x0200000011544C309C7171CC58E181C91A38650CF0B7103A0000000000000000000000000000000000000000  70  230 0x0600060011544C3060702EDD6600000001000000000000000000000000000000000000000000000000000000  6   1   D137311B-80AB-4E17-BC86-DBBEA03244D7    0   IO_COMPLETION   288 IO_COMPLETION       2   1   20682237    0x440031003300370033003100310042002D0038003000410042002D0034004500310037002D0042004300380036002D004400420042004500410030003300320034003400440037    0   0   772 70871   0   0x8092E7FD3A7C2D84  6   32169   103713  2147483647  us_english  mdy 7   1   1   1   0   1   1   1   1   2   -1  0   0   0   0   0   0   2000000024  0xE627D5B8AD4C8E22  0x7D10726F72195BFD  0x09009C7171CC58E181C91A38650CF0B7103A0000000000000000000000000000000000000000000000000000  9   1   NULL    NULL

waiting_task_address    session_id  exec_context_id wait_duration_ms    wait_type   resource_address    blocking_task_address   blocking_session_id blocking_exec_context_id    resource_description
0x8092E7FD3A7C2D84  64  0   289 IO_COMPLETION   NULL    NULL    NULL    NULL    NULL

0 个答案:

没有答案