Re: [GENERAL] Using PL/R for predictive analysis of data.

2008-03-17 Thread Josh Tolley
On Mon, Mar 17, 2008 at 2:27 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi Sam,
>
>  Thankyou for the suggestions. They make perfect sense to me. I
>  appreciate your time and input. The lack of optimiser usage was
>  something that I had not considered, and I thank you for making me
>  aware of it.
>
>  Cheers
>
>  The Frog

On the subject of the planner and optimizer, as of 8.3 (I think it's
new to 8.3...) you can tell the planner somewhat about how it might
expect your function to behave. See
http://www.postgresql.org/docs/8.3/interactive/sql-createfunction.html

- Josh/eggyknap

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Using PL/R for predictive analysis of data.

2008-03-17 Thread [EMAIL PROTECTED]
Hi Sam,

Thankyou for the suggestions. They make perfect sense to me. I
appreciate your time and input. The lack of optimiser usage was
something that I had not considered, and I thank you for making me
aware of it.

Cheers

The Frog

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Using PL/R for predictive analysis of data.

2008-03-14 Thread Sam Mason
On Wed, Mar 12, 2008 at 09:35:24AM -0700, [EMAIL PROTECTED] wrote:
> In short R appears to have more than enough capability to do the job
> (from a statistical perspective), however there doesnt seem to be that
> much discussion on using the PL/R implementation, or for that matter
> tutorials on using PL/R.

I've not used PL/R either, but I've used R on it's own a bit and I've
done a bit of PL/pgSQL programming as well.

> What I would like to know is:
> 1/ Is is possible to create a view that has its columns based on the
> output of a PL/R function?

You're after something called set returning functions, i.e. a function
that has "RETURNS SETOF" in it's definition.  There's an example in the
docs[1].  To create a view from this example, do

  CREATE VIEW emps AS
SELECT * FROM get_emps();

The problem with this is that the optimiser can't "see inside" the
function and do much fancy optimisation any more.  I can't help with
your other questions.

> Any advice or counsel would be greatly appreciated.

I'd get everything working separately before trying to bring it all
together.  I.e. get the regressions working in plain R using data
extracted by hand before trying to do everything in PG.


  Sam

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Using PL/R for predictive analysis of data.

2008-03-14 Thread [EMAIL PROTECTED]



-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general