Are SQL functions better than PG/SQL ones?

Started by Vitaly Belmanalmost 22 years ago3 messagesgeneral
Jump to latest
#1Vitaly Belman
vitalyb@gmail.com

I ready somewhere that PostgreSQL is able to optimize SQL functions,
the same way it does with views. For example if you do:

select * from cv_customers() order by customer_id;

When customers is an SQL function the optimizer/planner will be able to
actually use the customer_id index.

From some tests I made it doesn't seem true.. Yet I am asking to know

for sure.

#2mike g
mike@thegodshalls.com
In reply to: Vitaly Belman (#1)
Re: Are SQL functions better than PG/SQL ones?

Have you run the analyze function on the table or database?

We would need to see the sql for your tests to determine why it was or
was not used.

By the way the pgsql-performance list is probably a much better place to
discuss this.

Mike

Show quoted text

On Sat, 2004-07-10 at 05:57, Vitaly Belman wrote:

I ready somewhere that PostgreSQL is able to optimize SQL functions,
the same way it does with views. For example if you do:

select * from cv_customers() order by customer_id;

When customers is an SQL function the optimizer/planner will be able to
actually use the customer_id index.

From some tests I made it doesn't seem true.. Yet I am asking to know

for sure.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

#3Vitaly Belman
vitalyb@gmail.com
In reply to: Vitaly Belman (#1)
Re: Are SQL functions better than PG/SQL ones?

I see. I'll redirect the question there then. Thanks.

On Fri, 16 Jul 2004 23:32:13 -0500, mike g <mike@thegodshalls.com> wrote:

Have you run the analyze function on the table or database?

We would need to see the sql for your tests to determine why it was or
was not used.

By the way the pgsql-performance list is probably a much better place to
discuss this.

Mike

On Sat, 2004-07-10 at 05:57, Vitaly Belman wrote:

I ready somewhere that PostgreSQL is able to optimize SQL functions,
the same way it does with views. For example if you do:

select * from cv_customers() order by customer_id;

When customers is an SQL function the optimizer/planner will be able to
actually use the customer_id index.

From some tests I made it doesn't seem true.. Yet I am asking to know

for sure.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

--
ICQ: 1912453
AIM: VitalyB1984
MSN: tmdagent@hotmail.com
Yahoo!: VitalyBe