Re: Postgresql Sort cost Poor performance?

2019-04-01 Thread tank.zhang
Thank you for your reply. 

qis3_dp2=>  SHOW lc_collate;
 lc_collate  
-
 en_US.UTF-8
(1 row)

Time: 0.311 ms
qis3_dp2=> 

qis3_dp2=> SELECT COUNT(DISTINCT SVIN) AS CHECKCARNUM ,SMTOC FROM
QIS_CARPASSEDSTATION A WHERE 1=1 AND A.SSTATIONCD = 'VQ3_LYG' AND
A.SLINYYY-MM-DD') AND A.DWORKDATE <= TO_DATE('2019-03-11','-MM-DD')
group by  SMTOC
;
 checkcarnum | smtoc 
-+---
  90 | HT6LHD700 NH731PA
 690 | HT6LHD700 NH788PA
  90 | HT6LHD700 R550P A
  30 | HT6LHD700 YR615MA
1141 | HT6MHB700 NH731PA



Is there any possibility of optimization?





--
Sent from: 
http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html




Re: Postgresql Sort cost Poor performance?

2019-04-01 Thread Andrew Gierth
> "tank" == tank zhang <6220...@qq.com> writes:

 tank>  smtoc| character varying(50)   |   |  | 
 tank>  Sort Key: smtoc

What is the output of  SHOW lc_collate;

One of the most common reasons for slow sorting is that you're sorting a
text/varchar field in a locale other than C. The slowdown for using
other locales varies according to the data, the locale, and the
operating system, but 8-20x slowdowns are very common, 50-100x slowdowns
are not unusual, and there have been reports of even worse cases with
unusual script combinations.

-- 
Andrew (irc:RhodiumToad)