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 1jPM7h-0005yP-0k for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 08:13:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPM7f-0000Tr-MH for pgsql-general@arkaria.postgresql.org; Fri, 17 Apr 2020 08:13:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPM7f-0000TK-4A for pgsql-general@lists.postgresql.org; Fri, 17 Apr 2020 08:13:15 +0000 Received: from mail.wordtothewise.com ([104.225.223.158]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPM7b-0006ee-Ja for pgsql-general@lists.postgresql.org; Fri, 17 Apr 2020 08:13:13 +0000 Received: from [192.168.0.206] (unknown [37.228.253.89]) by mail.wordtothewise.com (Postfix) with ESMTPSA id D40F69F1F7 for ; Fri, 17 Apr 2020 01:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wordtothewise.com; s=aardvark; t=1587111190; bh=I6wMF4QFVMlL+sh3UXuunl5h+yim5SlLnEY+EmUWuY4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=hncEJTRFIys2/tngLumjdPglB5gbXRmD6NaRKasxfMYICeHL2CBN1xhBk2NAfvQpA RUkGvsKfKZUMtn5xjr1Qcaru3fAHymdkIDEzwYvPBfZ5tSmZi41O+RHX9NUm9G3doZ 1J+krlyejrr0l9v1MokamXOBIfXRAjprBsTUE9ww= Subject: Re: Using unlogged tables for web sessions To: pgsql-general@lists.postgresql.org References: From: Steve Atkins Message-ID: <856f24eb-91e5-94ef-4a32-cb57302275db@blighty.com> Date: Fri, 17 Apr 2020 09:13:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.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 On 16/04/2020 19:39, Stephen Carboni wrote: > Hello. > > I was wondering if anyone was using unlogged tables for website > sessions in production. I'm interested if it breaks the prevailing > opinion that you don't put sessions in PG. I generally put sessions in postgresql, with regular tables, when I'm using persistent server-side sessions, rather than just stashing all the user data in a signed cookie or local storage. It ... works fine? It drastically simplifies app deployment to have a single point of persistent storage, and having one that you can easily interrogate by hand simplifies development and debugging. Reads are a single indexed query, writes are typically HOT, so the IO and overhead aren't drastically different from any other persistent store. A lot of webapp development advice is based on "Ah, but how will you scale it up to Facebook levels of traffic?" and then skipping over the answer "Um, I won't ever need to. And if I did I'd have enough revenue to hire someone very, very good to rearchitect my session storage.". Cheers,   Steve