Re: Interesting question - Mailing list pgsql-hackers

From Larry Rosenman
Subject Re: Interesting question
Date
Msg-id 20010519072147.A20410@lerami.lerctr.org
Whole thread Raw
In response to Re: Interesting question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
* Tom Lane <tgl@sss.pgh.pa.us> [010518 22:39]:
> Larry Rosenman <ler@lerctr.org> writes:
> > CREATE FUNCTION "nowminus" (interval) RETURNS timestamp with time zone AS 'SELECT now() - $1;' LANGUAGE 'sql';
> 
> Right idea, but you need to mark it iscachable.
Aha:

Same query, with nowminus marked iscachable:
NOTICE:  QUERY PLAN:

Sort  (cost=513.69..513.69 rows=447 width=120) ->  Index Scan using start_index, end_index on attack_db
(cost=0.00..494.01rows=447 width=120)       SubPlan         ->  Seq Scan on exempt_ips  (cost=0.00..1.04 rows=4
width=12)        ->  Seq Scan on exempt_ips  (cost=0.00..1.04 rows=4 width=12)
 

EXPLAIN
> 
>             regards, tom lane


-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Plans for solving the VACUUM problem
Next
From: Bruce Momjian
Date:
Subject: Re: Plans for solving the VACUUM problem