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 1j4MuL-0007rU-3M for pgsql-performance@arkaria.postgresql.org; Wed, 19 Feb 2020 10:48:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j4MuJ-00088i-S8 for pgsql-performance@arkaria.postgresql.org; Wed, 19 Feb 2020 10:48:43 +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 ) id 1j4MuJ-00088b-EM for pgsql-performance@lists.postgresql.org; Wed, 19 Feb 2020 10:48:43 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j4MuG-0004gx-IP for pgsql-performance@lists.postgresql.org; Wed, 19 Feb 2020 10:48:43 +0000 Received: by mail-wm1-x341.google.com with SMTP id t23so76892wmi.1 for ; Wed, 19 Feb 2020 02:48:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=HfX/OCEn1svHUWuJL5AjyItrJumN18Ng7YEFH6qs4JM=; b=Hkfn2Bkj0Wxw2xXgkAG9Wl98Sbk+xiudFga84Y9Q8XInxMENdBJtMef0FvFSkJWaBv FgnB1Cr0DXYKNBxCaWisUBub//Urm9tTTS8etm5k/Da11u0DFGshxo6pFltAh7P3+tvK thDnnqQWRiehvJGb/wYnC+qpNs+65Z7S4YQzqPZggMUsR40xq8ZRDWyUwiLdt00aHuAk VffIK2GgFex6RW7HDUB3kuK1WSAXixYU40GlcYPXtxxeNR7N52xrHsM2dEbU7VV24KgY REQQ5l/o836ecqjCgrOE8sIQwhTK3JIjRqdC+WOz/z8hXyLs7VFxqNLdhpvH2DYcq8tp gIDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=HfX/OCEn1svHUWuJL5AjyItrJumN18Ng7YEFH6qs4JM=; b=QoU3Pv0mEMPsosHB90ix1xYPef+8wCkEr1uXg9GhmDjKhuXTB5kLUx+JbXExzcQ2AN jI9eu74w8UvfrMtxMjV1P/9ppvZweXMtHRBudzbHaKZpmCTA14D/0aIa6cpqxuUGacOu CVBnDQSmlGdpRB4eR3DuJXsp8CSbhNy3+VoZMffGtwTgH9iM6MqtHVxoQUha/nO7IFpv 3w4xUCiXwa5/5/+D0489sH2VkCUDsvFY3fuoJzdApmgAPWcB4yPQ7fzOA3hVoEuY0eYh XjOodm1OAMcrft+tNXEs4aBAQu1TOm27DvK1iHv/B9811xdbBJVxMdZLFvaeqqN4/c9E /itg== X-Gm-Message-State: APjAAAWmOjXfuCKJkixurSBKs6NbIXEXYCUV6CrXql5XS/UjBVnUlkYY 9DXgtNr4BqqK0q6iU4CU4riaeIEHFs0= X-Google-Smtp-Source: APXvYqwXxtjCjUR7k5OwOLHApMmK918KQ45GUkEvjzPhBeQAt+d9uqh9CE8KLLG52QF216WUUiMbNw== X-Received: by 2002:a05:600c:2481:: with SMTP id 1mr9196709wms.120.1582109319718; Wed, 19 Feb 2020 02:48:39 -0800 (PST) Received: from localhost.localdomain ([212.186.219.234]) by smtp.gmail.com with ESMTPSA id b67sm2511385wmc.38.2020.02.19.02.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:48:39 -0800 (PST) Message-ID: <167f5d4ec9c3cc46c78300d3db323e0b38883a67.camel@cybertec.at> Subject: Re: tablespace to benefit from ssd ? From: Laurenz Albe To: Nicolas PARIS , "pgsql-performance@lists.postgresql.org" Date: Wed, 19 Feb 2020 11:48:38 +0100 In-Reply-To: <87ftf7fari.fsf@riseup.net> References: <87ftf7fari.fsf@riseup.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, 2020-02-19 at 05:42 +0100, Nicolas PARIS wrote: > I have both hdd and ssd disk on the postgres server. The cluster is > right now created on the hdd only. I am considering using a tablespace > to put some highly used postgres object on the ssd disk. Of course the > ssd is small compared to the hdd, and I need to choose carefully what > objects are stored on that side. > > I am wondering what kind of object (indexes, data) would benefit from > ssd. The database primary/foreign keys are highly used and there is > almost no sequencial scan. However the server has a large amount of ram > memory and I suspect all of those indexes are already cached in ram. > > I have read that tablespaces introduce overhead of maintenance and > introduce complication for replication. But on the other hand I have > this ssd disk ready for something. > > Any recommandation ? Put "pg_stat_statements" into "shared_preload_libraries" and restart the server. Set "track_io_timing" to on. Let your workload run for at least a day. Install the "pg_stat_statements" extension and run SELECT blk_read_time, query FROM pg_stat_statements ORDER BY blk_read_time DESC LIMIT 20; That will give you the 20 queries that spent the most time reading from I/O. Examine those queries with EXPLAIN (ANALYZE, BUFFERS) and see which tables or indexes cause the I/O. Then you have a list of candidates for the fast tablespace. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com