后面经检查发现在这套系统中,有大理SQL使用了/*+ rule */ Hint,最好的处理方法是修改SQL代码,这里为了应急我使用了_optimizer_
某医保系统在业务高峰期间相关模块使用不了查询不出结果,生成业务高峰期间上午10点到11点期间的AWR报告
从上面的top sql部分可以看到执行时间最长的已经达到19019秒,还有几个运行时间也要执行几千秒,其中SQLID为d7bv3q1camq5x的SQL逻辑读和物理读都在几千万甚至上亿次。而每次也就返回200多行记录。
其中SQL语句为:
select /*+ rule */
a.stat_type,
a.his_item_code,
a.his_item_name,
a.item_code,
max((select count(*)
from mt_fee_fin aa
where a.hospital_id = aa.hospital_id
and a.serial_no = aa.serial_no
and a.item_code = aa.item_code)) as item_sn,
a.item_name,
a.medi_item_type,
a.price,
sum(a.dosage) as dosage,
a.model,
replace(a.standard, ' ', '') as standard,
sum(a.money) as money,
sum(nvl(d.audit_money, 0)) as audit_money,
d.hosp_reason_staff as hosp_reason_staff,
d.hosp_reason_date as hosp_reason_date,
d.hosp_reason_staffid as hosp_reason_staffid,
d.hosp_reason as hosp_reason,
d.center_resualt as center_resualt,
d.center_flag as center_flag,
d.audit_reason_id as audit_reason_id,
sum(nvl(b.all_cash, 0)) as all_cash,
(case
when a.medi_item_type = '0' then
(SELECT bo_flag
FROM bs_item
WHERE bs_item.item_code = a.item_code
AND ROWNUM else
(SELECT bo_flag
FROM bs_medi
WHERE bs_medi.medi_code = a.item_code
AND ROWNUM end) as bo_flag,
sum(nvl(b.part_cash, 0)) as part_cash,
decode(nvl(d.audit_reason_id, 0),
0,
d.audit_reason,
'%%' || to_char(d.audit_reason_id) || '%%') as audit_reason
from mt_fee_fin a,
pm_account_biz c,
pm_fee_audit d,
(select hospital_id,
serial_no,
policy_item_code,
serial_fee,
fee_batch,
SUM(decode(fund_id,
'999',
decode(b.label_flag, '101', real_pay, 0),
'003',
decode(label_flag, '101', real_pay, 0),
0)) AS all_cash,
SUM(decode(fund_id,
'999',
decode(b.label_flag, '102', real_pay, 0),
'003',
decode(label_flag, '102', real_pay, 0),
0)) AS part_cash
from mt_pay_record_fin b
where b.hospital_id = '4307210003'
and b.serial_no = '25735455'
and serial_fee 0
and valid_flag = '1'
group by hospital_id,
serial_no,
policy_item_code,
serial_fee,
fee_batch) b
where a.hospital_id = c.hospital_id
and a.serial_no = c.serial_no
and a.hospital_id = '4307210003'
and a.serial_no = '25735455'
and a.hospital_id = b.hospital_id(+)
and a.serial_fee = b.serial_fee(+)
and a.serial_no = b.serial_no(+)
and a.fee_batch = b.fee_batch(+)
and a.valid_flag = '1'
and c.valid_flag = '1'
and d.audit_staff_id(+) = 2103
and d.AUDIT_PHASE(+) = '1'
and d.serial_fee(+) 0
and a.serial_fee = d.serial_fee(+)
and d.account_id(+) = 16905170
and c.account_id = 16905170
group by a.stat_type,
a.item_name,
a.his_item_name,
a.price,
a.his_item_code,
a.item_code,
a.medi_item_type,
a.model,
a.standard,
d.hosp_reason,
d.center_resualt,
d.center_flag,
d.hosp_reason_staff,
d.hosp_reason_date,
d.hosp_reason_staffid,
d.audit_reason_id,
d.audit_reason
Order By a.stat_type, a.item_name, a.his_item_name

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters

mysqloffersechar,varchar,text,and denumforstringdata.usecharforfixed Lengttrings,varcharerforvariable長度,文本forlarger文本,andenumforenforcingDataAntegrityWithaEtofValues。

優化MySQLBLOB請求可以通過以下策略:1.減少BLOB查詢頻率,使用獨立請求或延遲加載;2.選擇合適的BLOB類型(如TINYBLOB);3.將BLOB數據分離到單獨表中;4.在應用層壓縮BLOB數據;5.對BLOB元數據建立索引。這些方法結合實際應用中的監控、緩存和數據分片,可以有效提升性能。

掌握添加MySQL用戶的方法對於數據庫管理員和開發者至關重要,因為它確保數據庫的安全性和訪問控制。 1)使用CREATEUSER命令創建新用戶,2)通過GRANT命令分配權限,3)使用FLUSHPRIVILEGES確保權限生效,4)定期審計和清理用戶賬戶以維護性能和安全。

chosecharforfixed-lengthdata,varcharforvariable-lengthdata,andtextforlargetextfield.1)chariseffity forconsistent-lengthdatalikecodes.2)varcharsuitsvariable-lengthdatalikenames,ballancingflexibilitibility andperformance.3)

在MySQL中處理字符串數據類型和索引的最佳實踐包括:1)選擇合適的字符串類型,如CHAR用於固定長度,VARCHAR用於可變長度,TEXT用於大文本;2)謹慎索引,避免過度索引,針對常用查詢創建索引;3)使用前綴索引和全文索引優化長字符串搜索;4)定期監控和優化索引,保持索引小巧高效。通過這些方法,可以在讀取和寫入性能之間取得平衡,提升數據庫效率。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3漢化版
中文版,非常好用

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Dreamweaver Mac版
視覺化網頁開發工具