Re: Speeding up this function
От | Jeremy Dunn |
---|---|
Тема | Re: Speeding up this function |
Дата | |
Msg-id | 008e01c4b614$c86aa550$4f01a8c0@jeremydunn обсуждение исходный текст |
Ответ на | Speeding up this function (Matt Nuzum <matt.followers@gmail.com>) |
Ответы |
Re: Speeding up this function
|
Список | pgsql-performance |
> -----Original Message----- > From: pgsql-performance-owner@postgresql.org > [mailto:pgsql-performance-owner@postgresql.org] On Behalf Of > Matt Nuzum > Sent: Tuesday, October 19, 2004 3:35 PM > To: pgsql-performance > Subject: [PERFORM] Speeding up this function > <snip> > > All it does is try to "link" pageviews together into a session. > here's the function: > create or replace function usage_normalize_session > (varchar(12), inet, timestamptz) returns integer as ' DECLARE > -- $1 = Account ID, $2 = IP Address, $3 = Time > RecordSet record; > BEGIN > SELECT INTO RecordSet DISTINCT sessionid FROM usage_access ua > WHERE ua.accountid = $1 > AND ua.client = $2 > AND ua.atime <= ($3 - ''20 > min''::interval)::timestamptz; > > if found > then return RecordSet.sessionid; > end if; > > return nextval(''usage_session_ids''); > END;' > language plpgsql; > This is probably a stupid question, but why are you trying to create sessions after the fact? Since it appears that users of your site must login, why not just assign a sessionID to them at login time, and keep it in the URL for the duration of the session? Then it would be easy to track where they've been. - Jeremy
В списке pgsql-performance по дате отправления: