Re: Interesting question

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Interesting question
Date: 2001-05-19 12:21:47
Message-ID: 20010519072147.A20410@lerami.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

* Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> [010518 22:39]:
> Larry Rosenman <ler(at)lerctr(dot)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.01 rows=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(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-05-19 12:23:37 Re: Plans for solving the VACUUM problem
Previous Message Bruce Momjian 2001-05-19 12:12:28 Re: Plans for solving the VACUUM problem