- SQL Server預設的隔離層級是RC(Read Committed)
- 使用Row Version Base的隔離層級,要好好管理TempDB並最佳化、大型交易分批做
- 使用RCSI要注意副作用(特別是和金額有關),最好不要在舊系統使用,新系統上線前可以完整測試比較安全
- SQL Server 2005之後支援RSCI(Read Committed Snapshot Isolation)和SI(Snapshot Isolation)的隔離層級,但這兩種層級不支援分散式交易
2020年5月23日 星期六
SQLServer隔離層級RCSI和SI的比較
https://github.com/imrexhuang/SQLServerIsolation-RCSIvsSI/
GROUP BY無法使用alias column name
原因:
https://stackoverflow.com/questions/3841295/sql-using-alias-in-group-by
問題描述:
SELECT country AS c, YEAR(hiredate) AS yearhired, COUNT(*) AS numemployees
FROM HR.Employees
WHERE hiredate >= '20140101'
GROUP BY country, YEAR(hiredate)
-- GROUP BY country, yearhired -- 無效的資料行名稱 'yearhired'。
HAVING COUNT(*) > 1
ORDER BY country, yearhired DESC;
--ORDER BY c, yearhired DESC; --可以執行
https://stackoverflow.com/questions/3841295/sql-using-alias-in-group-by
SQL is implemented as if a query was executed in the following order:
- FROM clause
- WHERE clause
- GROUP BY clause
- HAVING clause
- SELECT clause
- ORDER BY clause
For most relational database systems, this order explains which names (columns or aliases) are valid because they must have been introduced in a previous step.
So in Oracle and SQL Server, you cannot use a term in the GROUP BY clause that you define in the SELECT clause because the GROUP BY is executed before the SELECT clause.
There are exceptions though: MySQL and Postgres seem to have additional smartness that allows it.
問題描述:
SELECT country AS c, YEAR(hiredate) AS yearhired, COUNT(*) AS numemployees
FROM HR.Employees
WHERE hiredate >= '20140101'
GROUP BY country, YEAR(hiredate)
-- GROUP BY country, yearhired -- 無效的資料行名稱 'yearhired'。
HAVING COUNT(*) > 1
ORDER BY country, yearhired DESC;
--ORDER BY c, yearhired DESC; --可以執行
2020年2月18日 星期二
指定 TLS 伺服器預設的 Diffie-hellman Helman 金鑰位長度,請建立ServerMinKeyBitLength
解釋:
DWORD是Unsigned integer (32-bit),0x00000800就是2048位元,1024被認為不安全
REF:
https://docs.microsoft.com/zh-tw/windows-server/security/tls/tls-registry-settings
https://thycotic.force.com/support/s/article/TLS-Diffie-Hellman-Hardening
KB3174644
https://docs.microsoft.com/en-us/security-updates/SecurityAdvisories/2016/3174644
Weak Diffie-Hellman and the Logjam Attack
https://weakdh.org
2019年10月6日 星期日
IIS設定了URL Rewrite但網頁回應404 Not Found
Pattern設定如下
http://localhost:8080/{R:0}
Rewrite URL設定如下
(examples.+)
因為SSL憑證設定在IIS,目的是把https請求導到Tomcat
但是設定好之後用瀏覽器連https和http都是HTTP 404 Not Found
但用Test pattern測試都是符合的
後來找到一篇文章
https://forums.iis.net/t/1238069.aspx
Did you enable the proxy in IIS manager->server node->application request
routing cache->proxy setting->enable.
發現還需要安裝IIS的ARR(Application Request Routing)模組
安裝ARR模組並啟用"Enable proxy"就正常了
Microsoft Application Request Routing 3.0 (x64)
https://www.microsoft.com/en-us/download/details.aspx?id=47333
http://localhost:8080/{R:0}
Rewrite URL設定如下
(examples.+)
因為SSL憑證設定在IIS,目的是把https請求導到Tomcat
但是設定好之後用瀏覽器連https和http都是HTTP 404 Not Found
但用Test pattern測試都是符合的
後來找到一篇文章
https://forums.iis.net/t/1238069.aspx
Did you enable the proxy in IIS manager->server node->application request
routing cache->proxy setting->enable.
發現還需要安裝IIS的ARR(Application Request Routing)模組
安裝ARR模組並啟用"Enable proxy"就正常了
Microsoft Application Request Routing 3.0 (x64)
https://www.microsoft.com/en-us/download/details.aspx?id=47333
訂閱:
文章 (Atom)
