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 1g1zHu-0004l7-DX for pgsql-admin@arkaria.postgresql.org; Mon, 17 Sep 2018 19:34:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g1zHt-0004sQ-1m for pgsql-admin@arkaria.postgresql.org; Mon, 17 Sep 2018 19:34:25 +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 1g1zHs-0004sJ-Mb for pgsql-admin@lists.postgresql.org; Mon, 17 Sep 2018 19:34:24 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g1zHp-0003i7-CF for pgsql-admin@lists.postgresql.org; Mon, 17 Sep 2018 19:34:23 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id B553D5F79C; Mon, 17 Sep 2018 15:34:20 -0400 (EDT) Date: Mon, 17 Sep 2018 15:34:20 -0400 From: Stephen Frost To: still Learner Cc: pgsql-admin@lists.postgresql.org Subject: Re: Big image tables maintenance Message-ID: <20180917193420.GB4184@tamriel.snowman.net> References: <20180917135820.GU4184@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gQWmi4/gjXV4gbyW" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --gQWmi4/gjXV4gbyW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * still Learner (stilllearner23@gmail.com) wrote: > On Mon, Sep 17, 2018, 19:28 Stephen Frost wrote: > > (limiting this to -admin, cross-posting this to a bunch of different > > lists really isn't helpful) > > > > * still Learner (stilllearner23@gmail.com) wrote: > > > I have a 10 TB size table with multiple bytea columns (image & doc)and > > > makes 20TB of DB size. I have a couple of issues to maintain the DB. > > > > *What* are those issues..? That's really the first thing to discuss > > here but you don't ask any questions about it or state what the issue is > > (except possibly for backups, but we have solutions for that, as > > mentioned below). >=20 > > 1. I Would like to separate the image column from the 10TB size table, > > > place it in a separate schema. The change should not result in any qu= ery > > > change in the application. Is it possible? Doing this it should not > > affect > > > the performance. > > > > How large are these images? PostgreSQL will already pull out large > > column values and put them into a side-table for you, behind the scenes, > > using a technique called TOAST. Documentation about TOAST is available > > here: > > > > https://www.postgresql.org/docs/current/static/storage-toast.htm > > >=20 > Image size is restricted in two digit KBs > only, but we have very large volume of data. The main reason to split the > image to different schema is to avoid data loss in future if corruption > occurs on the table. Also maintenance would be easier compared to now. The > Db growth is much faster, I can say 1 Tb per quarter. "two digit KBs" doesn't actually provide much enlightenment. I'd suggest you check for and look at the size of the TOAST table for your environment. As for growth, you'd probably be best off looking at partitioning the large data set once you've gotten the system up to 10.5, but that's mostly to make it easier to manage the data and to do things like expire out old data. > > > 2. I can't maintain files on File system as the count is huge, so > > thinking > > > of using any no-sql mostly mongo-DB, is it recommended? Or PostgreSQL > > > itself can handle? > > > > I suspect you'd find that your data size would end up being much, much > > larger if you tried to store it as JSON or in a similar system, and > > you're unlikely to get any performance improvement (much more likely the > > opposite, in fact) >=20 > We are also considering document management tools. Not really sure what that changes here, but doesn't seem like much. > For these type of huge amount of data,is it advisable to keep the images = in > bytea type only or Jsonb( I haven't used yet) is also an option? If you go to JSONB then you'd likely end up seriously increasing the size, so, no, I wouldn't suggest going there for binary image data. > > 3. Taking the backup of 20TB data, is big task. Any more feasible solut= ion > > > other than online backup/pg_dump? > > > > Absolutely, I'd recommend using pgBackRest which supports parallel > > online backup and restore. Using pg_dump for a large system like this > > is really not a good idea- your restore time would likely be > > particularly terrible and you have no ability to do point-in-time > > recovery. Using pgBackRest and a capable system, you'd be able to get a > > complete backup of 20TB in perhaps 6-12 hours, with similar time on the > > recovery side. If you wish to be able to recover faster, running a > > replica (as well as doing backups) may be a good idea, perhaps even a > > time-delayed one. >=20 > Yeah I will try pgBackrest. We are already having time dealy replica. That's good. > > > Each image retrieval is > > > > Unfinished thought here..? > > Sorry, some how I missed to complete. I supposed to say, image rerival > ratio would be 1:10, mean once each image inserted it would be retrieved = by > the application more about 10 times for verification and prints etc. If there's an issue with the load associated with retriving the images then I would suggest that you stand up a physical replica or two and then move the read load to those systems. > Viewing the current data growth how long I mean till what size I can > survive with this type of flow. In other words, just dont want to survive > but would like build a robust environment. PostgreSQL is quite robust and can handle a very large amount of data. You can improve on that by having physical replicas which are available for failover and handling high read load. At 1TB/quarter, it seems very unlikely that you'll run into any serious limitations in PostgreSQL any time soon. Thanks! Stephen --gQWmi4/gjXV4gbyW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJboAG8AAoJEO1sijiDR2RV0SsP/RvgdsX/+vVNcopIs58xuKE5 xR2axrJEmHc0yV+tPvxhWcwPwGvBGAx7UrdROLbHWTRnBfe49Bsjlcymn8V5kn0X fEtXXI9skOP1/Pso+rP0UKt+kFAraURe0w44+aasxBcvBDRU4EJgfzU+7M8MO+YG cajZbtJPUdj76BjZ8R75990cbLni9jqdiJisOJ2CK75VZUfVufLks8M7a4r0v1jY Wo+ItlJ8iUXVF8mWyxgv5zmnZtCUvL1V2qMVHGxC6OyqOrZczPFgilIm85qH9n23 07oXk8hGnvSb2r+7dFVt8K5XOgBSf5ppzRm4VjpeuCrtdDrNbsk8qVEMNskBCLAq /bveDCA0ManuD9nbOMCxvzmBUSj8gju+7YGmgEGFE6zqwV+YYcd6yqIHaUZAdlCm BhnXj4OG1uinT8a+nsRS4atBE5YlOPj291UwKqCq9Iy1BC7u2KmfhfpqMjlkSlRV EWyCP+//nKsiQJ3PKDEfJHS2ps29Y31uIlpY43Ru2XBbmjrYstmmIqpV7JymRg/f xl1aa9r0PMDdP23jvml0N3dKx0U0/zNKYbkVgyR6hy4TCjxCavLr9E+NQIuSJDOw s9a887hTzQIkMSfXyF8UiIsFvILsaXaLfm8CCf9wJV3kBLMX7SoJz5zqFxWKGphy twYH/aXAGN+nK4zmH5Jk =eZO9 -----END PGP SIGNATURE----- --gQWmi4/gjXV4gbyW--