Re: Correct/optimal DML query for application session management ? - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Correct/optimal DML query for application session management ?
Date
Msg-id 7DD40C2A-1698-4C3F-BA26-49974C468AEE@gmail.com
Whole thread Raw
In response to Correct/optimal DML query for application session management ?  (Tim Smith <randomdev4+postgres@gmail.com>)
List pgsql-general
> On 06 Jan 2015, at 19:02, Tim Smith <randomdev4+postgres@gmail.com> wrote:
> create table app_sessions(
> session_id char(64) unique not null,
> user_id char(32) unique not null,
> session_start bigint not null,
> session_lastactive bigint not null
> );

Just an observation: Are you sure that you don’t want to allow your users to have multiple sessions? You made users
uniqueacross the entire table, which mean there can only ever be one session for a user. Unless you delete ‘expired’
sessionsASAP, users won’t be able to start a new session again after their original session expired. 
That may be desirable for your application and thus intended, but perhaps it was not?

Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.



pgsql-general by date:

Previous
From: Andy Colson
Date:
Subject: Re: Correct/optimal DML query for application session management ?
Next
From: Michael Heaney
Date:
Subject: Re: Advice for using integer arrays?