Re: [SQL] materialize

2007-11-26 Thread Tom Lane
Ehab Galal <[EMAIL PROTECTED]> writes: > I was wondering why do we need the Materialize node in the plan below when i > explain a query? It's cheaper to scan a materialized rowset many times than a raw table --- we don't need to re-access shared memory nor re-check row visibility.

[SQL] materialize

2007-11-26 Thread Ehab Galal
Greetings, I was wondering why do we need the Materialize node in the plan below when i explain a query? 1: QUERY PLAN = "Nested Loop (cost=10.99..24.34 rows=1 width=846)"(typeid = 25, len = -1, typmod = -1, byval = f) 1: QUERY PLAN = " Join Filter: (("inner".cover)::text = ("

[SQL] PG trouble with index-usage in sort

2007-11-26 Thread Andreas Joseph Krogh
Hi all. I'm seeing something fishy when trying to self-join two large tables and then order by one column. I have the following schema: CREATE TABLE origo_person( id SERIAL PRIMARY KEY, firstname varchar, lastname varchar, created timestamp not null default now(), created_by integer REFERENCES

Re: [SQL] dynmic column names inside trigger?

2007-11-26 Thread Bart Degryse
Functionally it's the same. The difference is that you don't have to DECLARE a variable for assembling your return value. It's either func(intext IN text, outtext OUT text returns NULL AS ( BEGIN ... return; END; ); or func(intext IN text) returns text AS ( DECL