欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

PostgreSQL本地化設(shè)置對SQL特性的影響有哪些-創(chuàng)新互聯(lián)

這篇文章主要介紹“PostgreSQL本地化設(shè)置對SQL特性的影響有哪些”,在日常操作中,相信很多人在PostgreSQL本地化設(shè)置對SQL特性的影響有哪些問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”PostgreSQL本地化設(shè)置對SQL特性的影響有哪些”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

為固鎮(zhèn)等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務,及固鎮(zhèn)網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務為網(wǎng)站制作、做網(wǎng)站、固鎮(zhèn)網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

PostgreSQL在使用initdb初始化數(shù)據(jù)庫時,提供了”本地化”的參數(shù)locale,如不指定該參數(shù)則默認為空,即使用OS的locale設(shè)定.
本地化設(shè)置對以下SQL特性有影響:
1.排序和比較操作 : Sort order in queries using ORDER BY or the standard comparison operators on textual data
2.內(nèi)置函數(shù) : The upper, lower, and initcap functions
3.模式匹配 : Pattern matching operators (LIKE, SIMILAR TO, and POSIX-style regular expressions); locales affect both case insensitive matching and the classification of characters by character-class regular expressions
4.to_char相關(guān)函數(shù) : The to_char family of functions
5.LIKE能否使用索引 : The ability to use indexes with LIKE clauses

排序
同樣的數(shù)據(jù),使用不同的LC_COLLATE,SQL輸出不同:

postgres=# SELECT name FROM unnest(ARRAY['MYNAME', ' my_name', 'my-image.jpg', 'my-third-image.jpg']) name ORDER BY name collate "C";
        name        
--------------------
  my_name
 MYNAME
 my-image.jpg
 my-third-image.jpg
(4 rows)
postgres=# SELECT name FROM unnest(ARRAY['MYNAME', ' my_name', 'my-image.jpg', 'my-third-image.jpg']) name ORDER BY name collate "zh_CN";
        name        
--------------------
 my-image.jpg
  my_name
 MYNAME
 my-third-image.jpg
(4 rows)

collate指定為”C”,則使用默認的字符串的二進制ASCII碼值進行對比,而指定是zh_CN則不是.

使用zh_CN其行為按不區(qū)分大小寫進行處理

postgres=# SELECT name FROM unnest(ARRAY['MYNAME1', ' my_name2', 'my-image.jpg', 'my-third-image.jpg']) name ORDER BY name collate "zh_CN";
        name        
--------------------
 my-image.jpg
 MYNAME1
  my_name2
 my-third-image.jpg
(4 rows)
postgres=# SELECT name FROM unnest(ARRAY['myname1', ' myname2', 'myimage.jpg', 'mythirdimage.jpg']) name ORDER BY name collate "zh_CN";
       name       
------------------
 myimage.jpg
 myname1
  myname2
 mythirdimage.jpg
(4 rows)

郵件列表中的解釋如下:

The behavior of each collation comes from the operating system’s own
libc, except for the C collation, which is based on the ordering
implied by strcmp() comparisons. Generally, most implementations have
the behavior you describe, in that they assign least weight of all to
caseness and whitespace, and somewhat more weight to punctuation. I
don’t think that there is much that can be done about it in practice,
though in principal there could be a collation that has all the
properties you want.

內(nèi)置函數(shù)
如initcap,在法語和C下面會有不同

postgres=#  select initcap('élysée' collate "C");
 initcap 
---------
 éLyséE
(1 row)
postgres=#  select initcap('élysée' collate "fr_FR");
 initcap 
---------
 élysée
(1 row)

在中文語境下,全角字符的小寫字母會轉(zhuǎn)換為全角的大寫字母

postgres=# select initcap('a' collate "zh_CN");
 initcap 
---------
 A
(1 row)
postgres=# select initcap('a' collate "C");
 initcap 
---------
 a
(1 row)

在LC_COLLATE下,只會對7F以下的ASCII字符生效,其他字符不生效

模式匹配

postgres=#  select 'élysée' ~ '^\w+$' collate "fr_FR";
 ?column? 
----------
 t
(1 row)
postgres=#  select 'élysée' COLLATE "C" ~ '^\w+$';
 ?column? 
----------
 f
(1 row)

LIKE能否使用索引

postgres=# CREATE TABLE t_sort (
postgres(#     a text COLLATE "zh_CN",
postgres(#     b text COLLATE "C");
CREATE TABLE
postgres=# 
postgres=# INSERT INTO t_sort SELECT md5(n::text), md5(n::text)
postgres-#     FROM generate_series(1, 1000000) n; 
INSERT 0 1000000
postgres=# CREATE INDEX ON t_sort USING btree (a);
CREATE INDEX
postgres=# CREATE INDEX ON t_sort USING btree (b);
CREATE INDEX
postgres=# ANALYZE t_sort;
ANALYZE
postgres=# SELECT * FROM t_sort LIMIT 2;
                a                 |                b                 
----------------------------------+----------------------------------
 c4ca4238a0b923820dcc509a6f75849b | c4ca4238a0b923820dcc509a6f75849b
 c81e728d9d4c2f636f067f89cc14862c | c81e728d9d4c2f636f067f89cc14862c
(2 rows)
postgres=# explain SELECT * FROM t_sort WHERE a LIKE 'c4ca4238a0%';
                                QUERY PLAN                                 
---------------------------------------------------------------------------
 Gather  (cost=1000.00..18564.33 rows=100 width=66)
   Workers Planned: 2
   ->  Parallel Seq Scan on t_sort  (cost=0.00..17554.33 rows=42 width=66)
         Filter: (a ~~ 'c4ca4238a0%'::text)
(4 rows)
postgres=# explain SELECT * FROM t_sort WHERE b LIKE 'c4ca4238a0%';
                                  QUERY PLAN                                  
------------------------------------------------------------------------------
 Index Scan using t_sort_b_idx on t_sort  (cost=0.42..8.45 rows=100 width=66)
   Index Cond: ((b >= 'c4ca4238a0'::text) AND (b < 'c4ca4238a1'::text))
   Filter: (b ~~ 'c4ca4238a0%'::text)
(3 rows)

使用zh_CN不能用上索引,但使用C可以用上索引

到此,關(guān)于“PostgreSQL本地化設(shè)置對SQL特性的影響有哪些”的學習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續(xù)學習更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

分享文章:PostgreSQL本地化設(shè)置對SQL特性的影響有哪些-創(chuàng)新互聯(lián)
文章路徑:http://www.aaarwkj.com/article22/pjdjc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、企業(yè)網(wǎng)站制作、關(guān)鍵詞優(yōu)化外貿(mào)建站、云服務器電子商務

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站
成人18禁视频免费看| 亚洲香蕉av在线一区二区三区| 欧美口爆吞精在线播放| 欧美国产日韩激情在线| 久久精品一区二区婷婷| 免费在线观看一区二区三区视频 | 深夜十八禁在线免费观看| 日韩高清有码一区二区| 蜜桃av网站免费观看| 久久精品国产亚洲av热老太| 欧美色一区二区三区四区| 丰满人妻被黑人猛烈进入| 日本欧美三级高潮受不了| 日韩精品免费一区二区三区| 日本一区二区三区不卡在线| 丝袜在线美腿视频网站| 欧美亚洲综合另类色妞| 97久久久人妻精品一区| 久久精品91久久久| 丁香色婷婷国产精品视频| 国产av超爽剧情系列| 亚洲高清有码在线观看| 欧美午夜福利视频观看| 日韩中文字幕视频久久| av在线手机中文字幕| 亚洲青青草原自拍偷拍| 香蕉夜夜草草久久亚洲香蕉| 国产精品日本欧美久久久| 日韩人妖视频在线观看| 亚洲成人自拍视频在线观看| 中文字幕91在线播放| 国产欧美精品久久三级| 午夜福利视频在线观看| 国产三级成人在线视频| 日韩亚洲欧美精品另类| 日韩精品中文字幕免费人妻| 免费福利激情在线播放| 日韩亚洲精品99综合观看| 成人中文字幕日韩电影| 尤物欧美精品一区二区三区| 在线免费观看91亚洲|