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 1jPDow-0003zW-Kb for pgsql-general@arkaria.postgresql.org; Thu, 16 Apr 2020 23:21:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPDov-0006HS-Dd for pgsql-general@arkaria.postgresql.org; Thu, 16 Apr 2020 23:21:21 +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 1jPDou-0006HL-Fr for pgsql-general@lists.postgresql.org; Thu, 16 Apr 2020 23:21:20 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jPDos-0002T9-4L for pgsql-general@lists.postgresql.org; Thu, 16 Apr 2020 23:21:19 +0000 Received: by mail-pl1-x62d.google.com with SMTP id ay1so231802plb.0 for ; Thu, 16 Apr 2020 16:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:subject:in-reply-to:message-id:date :mime-version; bh=wCsbmq6XqArNvEXJimxQAy4PFV/oLb+HqRHPhWvSuBE=; b=FkJg/47yk53Z2xJwzkY3JGvZjvRG5t2QGC2ClE3zg8hDrFpIfUhF2jh/mt1O2k3CH5 BKEb83GbeyLv4jv46Xg4pZUn7gZtZlufXHfutIUDIcdifAMpznhIBseDAZphr6Jv5h4I tbcEMV3Ci3UuQ97U5S1MmHYSBIDJyl9tCOWv40cmPhTz9eryDRBnY5Ohr8UI4cOzWoaF V54KTYbL+4Y7xmMZ6Ti/FAv/Er+L3LeyrkeX4/q/zOebEQMRu9bRQdSultNgYuoJCkWT qWBvmjBFRYCDRh2wN/FBekH8i6pPr57PErURmiVNeFk88/AWUcfT/59A9GF06oy65v1l 3XXg== 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:subject :in-reply-to:message-id:date:mime-version; bh=wCsbmq6XqArNvEXJimxQAy4PFV/oLb+HqRHPhWvSuBE=; b=qIBVBges0XPf5AWkSdHNW6LbSVM9G+LUDd9bOlqKTkZ+3aTEndNTGiMcm8JUoe13CG ZmeQTphPPCaPT5a+05JVZoJcGLTqI7tmuZhYmBc+XkeZOi0mKCreRT12o41u6XC43MUc RoLZlM7p0z9XlplA9MINpWPMlF7EuESPRaZ/G2kT3Fm11LEQKz/UaeycEQJxMhn73+AL ZN18Wi1SZzgJ8YbxMcQXQPyDD9Dre/9ek3BOGB1N7SbPgLEkb2x5eKJ0zzh45IvA5pR0 fg7daL98BCcwMUuXgi7MXEZMcdEk6RpKIzEXt00QsktHFPErruxaESzCNACP//GF+d2k ux7A== X-Gm-Message-State: AGi0Pubz/U4a2ZXGGQt+iFqBLIzcvlE0IQSPHyYjKGhhLStEcYSqDQEK rQMc/WzhkMT3n8lktFN/ThL12KfL7S4= X-Google-Smtp-Source: APiQypLkNJgfJynOxjBIqDSK9bELMSFzrXSBzeo+LFJ7Vc6qmeoM8GnbIHaXwo1drVir136g6gn5DA== X-Received: by 2002:a17:90b:198e:: with SMTP id mv14mr882651pjb.69.1587079276330; Thu, 16 Apr 2020 16:21:16 -0700 (PDT) Received: from tim-desktop (106-69-155-3.dyn.iinet.net.au. [106.69.155.3]) by smtp.gmail.com with ESMTPSA id 25sm3751244pjl.2.2020.04.16.16.21.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2020 16:21:15 -0700 (PDT) References: User-agent: mu4e 1.3.10; emacs 27.0.90 From: Tim Cross To: pgsql-general@lists.postgresql.org Subject: Re: Using unlogged tables for web sessions In-reply-to: Message-ID: <877dyf10go.fsf@gmail.com> Date: Fri, 17 Apr 2020 09:21:11 +1000 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Carboni writes: > 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. This really depends on what you define as website session data and what benefit you would see compared to the additional overhead of maintaining this session information remotely (from the client). Depending on your application, there is often some session information which makes more sense stored on the back end server rather than in the client - notably, data used by your server API to modify responses or possibly encrypted data to handle 'remember me' type functionality. However, you probably don't want to store session data used by the client API e.g. browser Javascript as this would introduce additional network overheads, latency, load on web and db server, increased web and db server API complexity and possibly additional data privacy/security concerns you will need to manage. This can be hard to justify when you have good client data storage facilities available. I have not come across a use case where it made sense to store ALL session data remotely in the database. I have seen situations with a very specialised application where having a more full featured LOCAL (to the client) database server to record session information can be useful, but this is rare. -- Tim Cross