Re: [ADMIN] cast not IMMUTABLE?

2004-05-08 Thread Stephan Szabo

On Fri, 7 May 2004, Gaetano Mendola wrote:

> Hi all,
> I have a table with ~ 3e+6 rows on it.
>
> I do select on this table in this way:
>
>
> (1) select * from user_logs where login_time::date = now()::date;
>
>
> consider that login_time is a TIMESTAMPTZ with an index on it.
>
> If I use the select in this way:
>
> select * from user_logs where login_time = now();
>
> the the index is used.
>
> I'm trying to use define and index in order to help the query (1):
>
>
> test# create index idx on user_logs ( (login_time::date) );
> ERROR:  functions in index expression must be marked IMMUTABLE
>
>
> why that cast is not considered IMMUTABLE ?

I'd think the conversion of a timestamptz -> date would be dependent on
timezone which would make it not immutable.


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html


Re: [ADMIN] hung postmaster when client machine dies?

2004-05-08 Thread Peter Galbavy
Goulet, Dick wrote:
> Hope you don't mind if I disagree.  Most OS's that have a tcp/ip
> layer also have a parameter therein called tcp_keep_alive.  They also
> set this parameter to infinity.  The purpose of tcp_keep_alive is to
> have the OS kernel periodically verify that all tcp/ip connections it
> is managing are still functioning every so often.  Basically the OS
> sends a probe packet down the line to the to the client machine.  If
> it bounces back the connection is dead & the OS can do what it has
> to, which will then notify postmaster just like you manually did.
> I'd contact your OS vendor for information of what tcp_keep_alive is
> set to by default and how you can change it.

On the other hand I suggest that you *do not* change this value, even if you
know how, without being very careful understanding what it means.

Changing the system-wide TCP KA time can have unforseen effects on other,
unrelated functions of the systems concerned.

This is simply why most long lived protocols layered over TCP also tend to
have their own keep alive PDUs.

Peter


---(end of broadcast)---
TIP 6: Have you searched our list archives?

   http://archives.postgresql.org