Re: SET variables
От | mlw |
---|---|
Тема | Re: SET variables |
Дата | |
Msg-id | 3AFE7E9C.1E28ECAE@mohawksoft.com обсуждение исходный текст |
Ответ на | SET variables (mlw <markw@mohawksoft.com>) |
Ответы |
Re: SET variables
|
Список | pgsql-hackers |
Tom Lane wrote: > mlw <markw@mohawksoft.com> writes: > > Would it be possible to allocate varibles that can be addressed with SET? > > And what would you do with them? > > There is a simple variable facility in psql these days, if that helps.g I was thinking more like: create variable fubar ; set fubar = select max(column) from table; select * from table where column = :fubar; Obviously this is a very simple example. I guess I am asking for something analogous to temporary tables, but on a single datum level. I like the way psql does it, but it would be better to have this available in the native query language. This is similar to a feature which Oracle has. It is mainly to avoid hitting the query planner. Oracle caches query execution instructions, and using a variable is a way to reuse cached queries with different data. Being able to set variables and use them in queries may help some people port from Oracle to Postgres. BTW I am also working on the impression that a view is more efficient than reissuing a complex query. Or is there no difference? > > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl
В списке pgsql-hackers по дате отправления: