Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oObMD-0004fA-7j for pgsql-general@arkaria.postgresql.org; Thu, 18 Aug 2022 08:58:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oObMC-0004zB-2p for pgsql-general@arkaria.postgresql.org; Thu, 18 Aug 2022 08:58:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oObMB-0004z2-Mw for pgsql-general@lists.postgresql.org; Thu, 18 Aug 2022 08:58:27 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oObM9-0007Yz-4w for pgsql-general@lists.postgresql.org; Thu, 18 Aug 2022 08:58:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Lpk/SNJg5DWYmvSOm5bql1IR2FbYWdh07dL5ALGhBxo=; b=ArnXfq/rOEsdbNhxXQMqu7z8pk Uom9TSu+P9xSMxcSqr9IrZHnygVlczNvXSQVFOyuUErnCFq6o4EqRHDPQ1zE3xijEj6FPkZjaiaQ8 Wdmgs7NbLyvT5K37EPif4bQKnT+050aXKr9fTJLz2B/c3khYwXdFUUP5hhat9zUi62EU=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1oObM6-0004LX-Ro; Thu, 18 Aug 2022 10:58:22 +0200 Date: Thu, 18 Aug 2022 10:58:22 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: "W.P." Cc: pgsql-general@lists.postgresql.org Subject: Re: Is it possible to keep indexes on different disk location? Message-ID: <20220818085822.GA12228@depesz.com> Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Aug 18, 2022 at 08:39:27AM +0200, W.P. wrote: > Is it possible to move  DB tables etc to this internal storage (sure > connection) and put only    indexes on USB  HDD? Sure. There is a thing called tablespace, which is basically, directory where files for db objects reside. You can specify it both when making new objects (https://www.postgresql.org/docs/current/sql-createtable.html, https://www.postgresql.org/docs/current/sql-createtable.html) and you can also move object between tablespaces ( (https://www.postgresql.org/docs/current/sql-altertable.html, https://www.postgresql.org/docs/current/sql-altertable.html). Just keep in mind that moving object means that it will get locked, data copied to new device, and then removed from old, and unlocked. > And will it help in case of losing connection to USB disk? (DB recoverable > instead of total crash)? Well, you need *all* data from all tablespaces to have fully working db. Best regards, depesz