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 1h4BD9-0000KY-UC for pgsql-general@arkaria.postgresql.org; Wed, 13 Mar 2019 21:14:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h4BD8-0005r7-Iq for pgsql-general@arkaria.postgresql.org; Wed, 13 Mar 2019 21:14:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4BD8-0005p2-2A for pgsql-general@lists.postgresql.org; Wed, 13 Mar 2019 21:14:50 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h4BD5-00038X-8g for pgsql-general@postgresql.org; Wed, 13 Mar 2019 21:14:48 +0000 Received: by mail-pf1-x444.google.com with SMTP id s22so2261453pfh.4 for ; Wed, 13 Mar 2019 14:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-transfer-encoding; bh=ypvh+NcQse5uDzEIXOvwZE5XvSFsiWPuFZN+u4IWTi4=; b=A6jHMLbwiPeIjloEXdYhDhy876hLohn8svI73VipfJoHgWnP/OI4MLXu3riCuT6u0U 29Q6XDj1KKZ6Zvm3Z8kjqmSnoALMNaN4MGecf/FvoMXiSYG4AiPOVLkGDAangLQsPvMr pfZzpqcdw3q4QRi8PHgR4lcupql2DTHjN5rdeBCkvvu3bHwwpfu2j/G8auBSSc5uoKnM 7yIXTFMXnaV3qMwb+XgrgYVkBmx+OILgtaMH6NqGi8PeEe29Qdn3E+shumKry5XwnjWl jWym/hsBSIkQ0FTG7Crk5WA5EOx4gGF6OuwOY27cxKkLq70vZDpolTWTMK3/kHeGiT5u M0og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version:content-transfer-encoding; bh=ypvh+NcQse5uDzEIXOvwZE5XvSFsiWPuFZN+u4IWTi4=; b=FupLoMbb2eb6cayfCtpiaIYIdle3k3hg0+Ug2Uh4/RKO1PE3GflFJuAsxK4zhB2Bmt VfMWjGY+PPN/TQ+YNUOnULX3Wwjip3q+3Zo61hZxwCnh5ko4aF/XUYL1RvdlIjetApNS Yf7VdKL21qkn34GotXTyszXGw7jDrjx2+360wWnva6iXOFjRdg8aYbJIsUh8/9xKmdaY QceHx1AjmKGJP04O805lfhOnkBjAbLwfNbOonxiraSkmdeBdg7tYEFWLf0EFGOuyEQpw ucXMSh3duQBuKcFonyzfxVJ4NR8XPit4ms7XD8IQgYJPK33qAwLBy7wwMDiHWbDSLYNZ sBTw== X-Gm-Message-State: APjAAAWwCJQAhEwM+6ts88HpPwqHB0zFjrMKyxsYj+djA8ZgVygM5jW8 S+f1WyOPPanHRjYWoAtCUdTqKqdidno= X-Google-Smtp-Source: APXvYqz8jGi01q7dXHoQxzCB2JYelqYnCQz8T5msGQMn0oN6paA/YWem4zGztG3vOtmUN1YhSDanQg== X-Received: by 2002:a63:694a:: with SMTP id e71mr25252023pgc.129.1552511685939; Wed, 13 Mar 2019 14:14:45 -0700 (PDT) Received: from tim-desktop (2001-44b8-31f2-bb00-c928-1ab6-609f-27bd.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:c928:1ab6:609f:27bd]) by smtp.gmail.com with ESMTPSA id z18sm28683291pfl.164.2019.03.13.14.14.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Mar 2019 14:14:44 -0700 (PDT) References: <666a8edc-6d86-ad8f-4ff8-101f108e6aa5@thomas-guettler.de> User-agent: mu4e 1.1.0; emacs 26.1 From: Tim Cross To: pgsql-general@lists.postgresql.org Cc: "pgsql-general\@postgresql.org" Subject: Re: Where to store Blobs? In-reply-to: <666a8edc-6d86-ad8f-4ff8-101f108e6aa5@thomas-guettler.de> Date: Thu, 14 Mar 2019 08:14:38 +1100 Message-ID: <87mulyo4sh.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I don't think there is a suitable 'one size fits all' answer to this question. A lot will depend on how you intend to use the blobs and what sort of hardware architecture, especially storage systems, you have. At first glance, sticking everything in the DB seems like an easy choice. However, that can result in very large databases, which in turn can lead to issues with respect to backup, replication etc. If all your after is storage, then sometimes your better off using the file system for the blobs and keeping the metadata in the db. It can potentially be faster and easier to serve up blobs from the file system compared to the db if that is the main use case, but if the blobs are more dynamic or you use collections of blobs to build a master blob etc, the db has some advantages. If you really need database like functionality, given the relative cheapness of storage and the wealth of options available, storing the blobs in the database can have advantage. However, it will be important to select the most appropriate datatype. What some people think of as a 'blob' is just an array of bytes to many DBs and as usual, you need to make the decision as to what is the best storage representation for your requirements, keeping in mind that the more general 'blob' like storage type you choose often represents a loss in functionality but an increase in flexibility wrt to what can be inserted over more precise data types, which will be more restrictive about what can be inserted, but offer more functionality regarding what you can do with it (at the db level). Tim Thomas G=C3=BCttler writes: > Some days ago I asked "Where **not** to use PostgreSQL?" on this mailing = list. > > Now I realized: Nobody talked about Blobs. > > I guess most people do not store Blobs in PostgresSQL. > > Where do you store Blobs? > > (In my case Blobs are PDF/image files with size up to 20 MByte. > I do not talk about very big blobs which are several hundret MByte) -- Tim Cross