Re: PostGres 9.5 [ and earlier ] "SET SEARCH_PATH TO "+ cSchema + ";"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Phil McGuinness" <sherlock(at)sherlock(dot)com(dot)au>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: PostGres 9.5 [ and earlier ] "SET SEARCH_PATH TO "+ cSchema + ";"
Date: 2016-06-30 14:09:11
Message-ID: 19688.1467295751@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Phil McGuinness" <sherlock(at)sherlock(dot)com(dot)au> writes:
> We used "SET SEARCH_PATH TO "+ cSchema + ";" to set say SHER2016 or
> SHERDATA.. where ever we need to be and open tables as normal.
> "INSERT INTO settings SELECT * FROM settings;") // We can use this
> syntax rather explicit say sherdata.
> .. Verse ..
> "INSERT INTO settings SELECT * FROM sherdata.settings;")

> When we use code with SET SEARCH PATH and not explicit schema the speed
> difference is 8 time slower.

This is really hard to believe, and you have not provided sufficient
detail to let someone else reproduce it.

A possible guess, though, comes from the fact that the default value of
search_path is *not* empty; it is

# show search_path ;
search_path
-----------------
"$user", public
(1 row)

If you are doing exactly what you show above, then you removed "public"
from your search path, as well as the schema corresponding to your user
name (if there is one). I wonder whether the "sherdata" schema contains
a different and slower version of some function or view than exists in
"public".

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-06-30 16:40:19 Re: BUG #14208: Inconsistent code modification - 3
Previous Message Phil McGuinness 2016-06-30 11:30:57 PostGres 9.5 [ and earlier ] "SET SEARCH_PATH TO "+ cSchema + ";"