msession for PostgreSQL?

From: pgsql(at)mohawksoft(dot)com
To: pgsql-hackers(at)postgresql(dot)org
Subject: msession for PostgreSQL?
Date: 2004-06-11 15:51:04
Message-ID: 16936.24.91.171.78.1086969064.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As you may or may not be aware, I've been sort of ranting about high speed
frequently updated tables the last few days. Sorry if I've annoyed anyone.

It occured to me last night that PostgreSQL's recent capability of
returning sets of rows from functions was a feature that a long abandoned
project needed to really work.

Msession is a high speed session manager designed for PHP. It is not MVCC,
is is strictly RAM based. It allows for plugins and other sort of cool
features. Last time I tested it, it easily handled 4000 full
read/process/update sessions a second across hundreds of connections. I
haven't done any real development on it in well over a year, but it still
has a number of users.

Conceptially, it is kind of similar to LDAP, but designed to provide some
database-esque features. To emulate its functionality, you would do
something like this in PostgreSQL:

create table sessions(
session_name varchar,
session_data varchar,
last_access timestamp,
created timestamp
);

create table session_variables
(
session_name varchar,
variable_name varchar,
variable_value varchar
);

Basically, sessions are "world-unique." The variable "session_data" is
used by PHP for storing PHP's internal session information. The table
session_variables is typically used by non-PHP applications. Anyway, if
you are curious, about it, checkout the docs on the PHP website, or
checkout http://www.mohawksoft.com/devel/msession.html

The server is still around, and aside from some cleanup and bug fixes, it
could operate with a set of user loadable functions to provide some neat
features:

Looking at the above table declarations, one can do this:

SELECT * FROM session_variables WHERE session_name = 'foobar' ;
Would looks something like this:
SELECT msession_get_array('session');

SELECT session_name FROM sessions;
Looks like:
SELECT msession_list();

UPDATE session_variables SET session_variable='foo' where
session_name='bar' and variable_name='name';
Looks like:
msession_set('bar', 'name', 'foo');

The best part of it could be that it could replace the whole msession C
API with PostgreSQL. You can join against the various data, and it should
be very fast with no MVCC overhead for those aspects of your project that
don't need it while still allowing them to be incorporated with the data
that does.

Would anyone find this useful?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2004-06-11 16:17:57 Re: Accelerating aggregates
Previous Message Manfred Spraul 2004-06-11 15:50:09 Re: Compiling libpq with VisualC