pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tank.zhang <6220104@qq.com>
To: pgsql-performance@postgresql.org
Subject: Re: Postgresql Sort cost Poor performance?
Date: Tue, 2 Apr 2019 00:00:09 -0700 (MST)
Message-ID: <1554188409091-0.post@n3.nabble.com> (raw)
In-Reply-To: <CADGuD5DDHfwsU+6MjwfmvUSYHc3K7bDe9Tf7jS41ybTOpQgxag@mail.gmail.com>
References: <1554111914781-0.post@n3.nabble.com>
	<CADGuD5DDHfwsU+6MjwfmvUSYHc3K7bDe9Tf7jS41ybTOpQgxag@mail.gmail.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <1554188409091-0.post@n3.nabble.com>
Permalink:  ../1554188409091-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1554188409091-0.post@n3.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: 6220104@qq.com
  Subject: Re: Postgresql Sort cost Poor performance?
  In-Reply-To: <1554188409091-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox