Re: parallel query

2019-04-02 Thread Laurenz Albe
Mariel Cherkassky wrote: > I wanted to a few questions regarding the parallel parameters : > max_worker_processes and max_parallel_workers_per_gather. > > 1)Basically, max_worker_processes should be set to the number of cpus I have > in the machine ? Setting it higher would not be smart. Setti

[no subject]

2019-04-02 Thread Mariel Cherkassky
Hey, I wanted to a few questions regarding the parallel parameters : max_worker_processes and max_parallel_workers_per_gather. 1)Basically, max_worker_processes should be set to the number of cpus I have in the machine ? 2)If I set max_worker_processes to X and max_parallel_workers_per_gather to Y

Re: Postgresql Sort cost Poor performance?

2019-04-02 Thread tank.zhang
Thank you replay! I tried to use the TMP table is very fast .thank you qis3_dp2=# explain analyze SELECT COUNT(*),SMTOC FROM ( SELECT DISTINCT(SVIN) AS CHECKCARNUM,SMTOC FROM QIS_CARPASSEDSTATION A WHERE 1=1 AND A.SSTATIONCD = 'VQ3_LYG' AND A.SLINENO IN ( '1F' , '2F' , '3F' ) AND A.DWORKDAT

Re: Postgresql Sort cost Poor performance?

2019-04-02 Thread David Rowley
On Tue, 2 Apr 2019 at 20:00, tank.zhang <6220...@qq.com> wrote: > 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

Re: Postgresql Sort cost Poor performance?

2019-04-02 Thread tank.zhang
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','-MM-DD') AND A.DWORKDATE <= TO_DATE('2019-03-11','