Re: [GENERAL] Query runs slow

2013-11-25 Thread Kevin Grittner
Hengky Liwandouw wrote: > On Nov 24, 2013, at 11:21 PM, Kevin Grittner wrote: >> Hengky Lie wrote: >> >>> this query takes long time to process. It takes around 48 >>> seconds to calculate about 690 thousand record. >> >>> Is there any way to make calculation faster ? >> >> Quite possibly -- that

Re: [GENERAL] Query runs slow

2013-11-24 Thread Hengky Liwandouw
Dear Kevin, After reading the link you gave to me, changing shared_buffers to 25% (512MB) of available RAM and effective_cache_size to 1500MB (about 75% of available RAM) make the query runs very fast. Postgres only need 1.8 second to display the result. Thanks a lot ! On Nov 24, 2013, at 11:

Re: [GENERAL] Query runs slow

2013-11-24 Thread Kevin Grittner
Hengky Lie wrote: > this query takes long time to process. It takes around 48 seconds > to calculate about 690 thousand record. > Is there any way to make calculation faster ? Quite possibly -- that's about 70 microseconds per row, and even fairly complex queries can often do better than that. 

[GENERAL] Query runs slow

2013-11-24 Thread Hengky Lie
Hi all, I have query like this : select subkategori,produkid, namabarang , sum(keluar) as ttlkeluar, sum(ttlmodal) as ttlmodal from ( select subkategori, kodebarang as produkid, namabarang, keluar, tbltransaksi.modal*keluar as ttlmodal, case when tbltransaksi.discount<=100 then keluar*(harga