Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffZOS-0000vr-Tp for pgsql-performance@arkaria.postgresql.org; Tue, 17 Jul 2018 23:28:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ffZOR-0003lY-7j for pgsql-performance@arkaria.postgresql.org; Tue, 17 Jul 2018 23:28:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffZOQ-0003lQ-PV for pgsql-performance@lists.postgresql.org; Tue, 17 Jul 2018 23:28:30 +0000 Received: from cat-porwal-prod-mail1.catalyst.net.nz ([202.78.240.226]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffZOL-0003Zg-OW for pgsql-performance@lists.postgresql.org; Tue, 17 Jul 2018 23:28:28 +0000 Authentication-Results: auth=pass smtp.auth=mark.kirkwood@catalyst.net.nz smtp.mailfrom=mark.kirkwood@catalyst.net.nz Received: from [IPv6:2406:e001:cf9:1:b008:12de:ec4a:828f] (unknown [IPv6:2406:e001:cf9:1:b008:12de:ec4a:828f]) (Authenticated sender: mark.kirkwood@catalyst.net.nz) by cat-porwal-prod-mail1.catalyst.net.nz (Postfix) with ESMTPSA id 3EE3B809F2; Wed, 18 Jul 2018 11:28:21 +1200 (NZST) Subject: Re: Why HDD performance is better than SSD in this case To: Nicolas Charles , Neto pr , Fabio Pardi Cc: pgsql-performance@lists.postgresql.org References: <01bbbc88-2a47-f078-ea40-ab2c1acafa1f@portavita.eu> From: Mark Kirkwood Message-ID: Date: Wed, 18 Jul 2018 11:28:20 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Yeah, A +1 to telling us the model. In particular the later EVOs use TLC nand with a small SLC cache... and when you exhaust the SLC cache the performance can be worse than a HDD... On 18/07/18 01:44, Nicolas Charles wrote: > Hi Neto, > > You should list the SSD model also - there are pleinty of Samsung EVO > drives - and they are not professional grade. > > Among the the possible issues, the most likely (from my point of view) > are: > > - TRIM command doesn't go through the RAID (which is really likely) - > so the SSD controller think it's full, and keep pushing blocks around > to level wear, causing massive perf degradation - please check this > config on you RAID driver/adapter > > - TRIM is not configured on the OS level for the SSD > > - Partitions is not correctly aligned on the SSD blocks > > > Without so little details on your system, we can only try to guess the > real issues > > > Nicolas > > Nicolas CHARLES > Le 17/07/2018 à 15:19, Neto pr a écrit : >> 2018-07-17 10:04 GMT-03:00 Neto pr : >>> Sorry.. I replied in the wrong message before ... >>> follows my response. >>> ------------- >>> >>> Thanks all, but I still have not figured it out. >>> This is really strange because the tests were done on the same machine >>> (I use  HP ML110 Proliant 8gb RAM - Xeon 2.8 ghz processor (4 >>> cores), and POSTGRESQL 10.1. >>> - Only the mentioned query running at the time of the test. >>> - I repeated the query 7 times and did not change the results. >>> - Before running each batch of 7 executions, I discarded the Operating >>> System cache and restarted DBMS like this: >>> (echo 3> / proc / sys / vm / drop_caches; >>> >>> discs: >>> - 2 units of Samsung Evo SSD 500 GB (mounted on ZERO RAID) >>> - 2 SATA 7500 Krpm HDD units - 1TB (mounted on ZERO RAID) >>> >>> - The Operating System and the Postgresql DBMS are installed on the >>> SSD disk. >>> >> One more information. >> I used default configuration to Postgresql.conf >> Only exception is to : >> random_page_cost on SSD is 1.1 >> >> >>> Best Regards >>> [ ]`s Neto >>> >>> 2018-07-17 1:08 GMT-07:00 Fabio Pardi : >>>> As already mentioned by Robert, please let us know if you made sure >>>> that >>>> nothing was fished from RAM, over the faster test. >>>> >>>> In other words, make sure that all caches are dropped between one test >>>> and another. >>>> >>>> Also,to better picture the situation, would be good to know: >>>> >>>> - which SSD (brand/model) are you using? >>>> - which HDD? >>>> - how are the disks configured? RAID? or not? >>>> - on which OS? >>>> - what are the mount options? SSD requires tuning >>>> - did you make sure that no other query was running at the time of the >>>> bench? >>>> - are you making a comparison on the same machine? >>>> - is it HW or VM? benchs should better run on bare metal to avoid >>>> results pollution (eg: other VMS on the same hypervisor using the >>>> disk, >>>> host caching and so on) >>>> - how many times did you run the tests? >>>> - did you change postgres configuration over tests? >>>> - can you post postgres config? >>>> - what about vacuums or maintenance tasks running in the background? >>>> >>>> Also, to benchmark disks i would not use a custom query but pgbench. >>>> >>>> Be aware: running benchmarks is a science, therefore needs a >>>> scientific >>>> approach :) >>>> >>>> regards >>>> >>>> fabio pardi >>>> >>>> >>>> >>>> On 07/17/2018 07:00 AM, Neto pr wrote: >>>>> Dear, >>>>> Some of you can help me understand this. >>>>> >>>>> This query plan is executed in the query below (query 9 of TPC-H >>>>> Benchmark, with scale 40, database with approximately 40 gb). >>>>> >>>>> The experiment consisted of running the query on a HDD (Raid zero). >>>>> Then the same query is executed on an SSD (Raid Zero). >>>>> >>>>> Why did the HDD (7200 rpm)  perform better? >>>>> HDD - TIME 9 MINUTES >>>>> SSD - TIME 15 MINUTES >>>>> >>>>> As far as I know, the SSD has a reading that is 300 times faster >>>>> than SSD. >>>>> >>>>> --- Execution  Plans--- >>>>> ssd 40g >>>>> https://explain.depesz.com/s/rHkh >>>>> >>>>> hdd 40g >>>>> https://explain.depesz.com/s/l4sq >>>>> >>>>> Query ------------------------------------ >>>>> >>>>> select >>>>>      nation, >>>>>      o_year, >>>>>      sum(amount) as sum_profit >>>>> from >>>>>      ( >>>>>          select >>>>>              n_name as nation, >>>>>              extract(year from o_orderdate) as o_year, >>>>>              l_extendedprice * (1 - l_discount) - ps_supplycost * >>>>> l_quantity as amount >>>>>          from >>>>>              part, >>>>>              supplier, >>>>>              lineitem, >>>>>              partsupp, >>>>>              orders, >>>>>              nation >>>>>          where >>>>>              s_suppkey = l_suppkey >>>>>              and ps_suppkey = l_suppkey >>>>>              and ps_partkey = l_partkey >>>>>              and p_partkey = l_partkey >>>>>              and o_orderkey = l_orderkey >>>>>              and s_nationkey = n_nationkey >>>>>              and p_name like '%orchid%' >>>>>      ) as profit >>>>> group by >>>>>      nation, >>>>>      o_year >>>>> order by >>>>>      nation, >>>>>      o_year desc >>>>> > >