Re: Postgresql Sort cost Poor performance?

From: "tank(dot)zhang" <6220104(at)qq(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Postgresql Sort cost Poor performance?
Date: 2019-04-02 07:00:09
Message-ID: 1554188409091-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

1、DISTINCT response time is fast without being added

qis3_dp2=# SELECT COUNT(*) AS CHECKCARNUM FROM QIS_CARPASSEDSTATION A WHERE
1=1 AND A.SSTATIONCD = 'VQ3_LYG' AND A.SLINENO IN ( '1F' , '2F' , '3F' ) AND
A.DWORKDATE >= TO_DATE('2017-02-11','YYYY-MM-DD') AND A.DWORKDATE <=
TO_DATE('2019-03-11','YYYY-MM-DD');
checkcarnum
-------------
2142215
(1 row)

*Time: 2237.970 ms (00:02.238)*
qis3_dp2=#

2、 Adding a DISTINCT response time was very slow

qis3_dp2=# SELECT COUNT(DISTINCT SVIN) AS CHECKCARNUM FROM
QIS_CARPASSEDSTATION A WHERE 1=1 AND A.SSTATIONCD = 'VQ3_LYG' AND A.SLINENO
IN ( '1F' , '2F' , '3F' ) AND A.DWORKDATE >=
TO_DATE('2017-02-11','YYYY-MM-DD') AND A.DWORKDATE <=
TO_DATE('2019-03-11','YYYY-MM-DD');
checkcarnum
-------------
1071367
(1 row)

*Time: 38979.246 ms (00:38.979)*

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message David Rowley 2019-04-02 07:42:07 Re: Postgresql Sort cost Poor performance?
Previous Message Ramón Bastidas 2019-04-02 05:25:54 Re: Postgresql Sort cost Poor performance?