Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hAuCw-00023n-GJ for pgsql-performance@arkaria.postgresql.org; Mon, 01 Apr 2019 10:30:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hAuCu-0000ua-Qg for pgsql-performance@arkaria.postgresql.org; Mon, 01 Apr 2019 10:30:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from <6220104@qq.com>) id 1hAuCu-0000sq-Gt for pgsql-performance@lists.postgresql.org; Mon, 01 Apr 2019 10:30:24 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from <6220104@qq.com>) id 1hAuCh-0000Uo-Su for pgsql-performance@postgresql.org; Mon, 01 Apr 2019 10:30:20 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id CF6EA12FB0288 for ; Mon, 1 Apr 2019 03:30:09 -0700 (MST) Date: Mon, 1 Apr 2019 03:30:09 -0700 (MST) From: "tank.zhang" <6220104@qq.com> To: pgsql-performance@postgresql.org Message-ID: <1554114609808-0.post@n3.nabble.com> In-Reply-To: <87d0m6uj5u.fsf@news-spur.riddles.org.uk> References: <1554111914781-0.post@n3.nabble.com> <87d0m6uj5u.fsf@news-spur.riddles.org.uk> Subject: Re: Postgresql Sort cost Poor performance? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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','YYYY-MM-DD') group by SMTOC ; checkcarnum | smtoc -------------+----------------------- 90 | HT6LHD700 NH731P A 690 | HT6LHD700 NH788P A 90 | HT6LHD700 R550P A 30 | HT6LHD700 YR615M A 1141 | HT6MHB700 NH731P A Is there any possibility of optimization? -- Sent from: http://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html