Re: Views and functions returning sets of records

From: Rajashri Tupe <rajashrivtupe(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Views and functions returning sets of records
Date: 2008-04-08 11:54:19
Message-ID: 47f1ca91-9877-419f-ad6a-f2d842980902@i36g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Can we write retrieving only 10 records from 4000 records
plz tell me asap

On Mar 23, 8:28 pm, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> Giorgio Valoti <giorgi(dot)(dot)(dot)(at)mac(dot)com> writes:
> > Are there any way to pass some hints to the planner? For example,
> > could the IMMUTABLE/STABLE/VOLATILE modifiers be of some help?
>
> Those don't really do anything for set-returning functions at the
> moment.
>
> As of 8.3 there is a ROWS attribute for SRFs that can help with one
> of the worst problems, namely that the planner has no idea how many
> rows a SRF might return. It's simplistic (just an integer constant
> estimate) but better than no control at all.
>
> As of CVS HEAD (8.4 to be) there's a capability in the planner to
> "inline" SRFs that are single SELECTs in SQL language, which should
> pretty much eliminate the performance differential against a comparable
> view. Unfortunately 8.4 release is at least a year away, but just
> so you know. (I suppose if you were desperate enough to run a privately
> modified copy, that patch should drop into 8.3 easily enough.) IIRC
> the restrictions for this to happen are
> * single SELECT
> * function declared to return set
> * function NOT declared strict or volatile
> * function NOT declared SECURITY DEFINER or given any
> local parameter settings
> The latter restrictions are needed so that inlining doesn't change
> the semantics.
>
> regards, tom lane
>
> -
> Sent via pgsql-performance mailing list (pgsql-performa(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-performance

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Stosberg 2008-04-08 13:45:07 Re: what worked: performance improvements for geo-spatial searching on FreeBSD
Previous Message Matthew 2008-04-08 11:02:00 Re: Forcing more agressive index scans for BITMAP AND