PostgreSQL具有递归性能 [英] PostgreSQL WITH RECURSIVE performance

查看:307
本文介绍了PostgreSQL具有递归性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的问题。

I have a simple question. Somehow I was unable to find a definitive answer.

在PostgreSQL中优化了语法的语法是什么?我的意思是:这仅仅是一系列非递归查询的语法糖,还是它的复杂语义整体上得到了优化,而仅仅是一个语句。后续问题-可以优化这种语法多少?当然,最欢迎提供有关此问题的一些具体数据。

How much is WITH RECURSIVE syntax optimized in PostgreSQL? By that I mean: is it merely a syntactic sugar for a series of non recursive queries, OR is it more of a single statement that despite its complicated semantics has been optimized as a whole. A follow-up question - just about how much is it possible to optimize this kind of syntax? Of course some concrete data on the matter is most welcome.

推荐答案

我的经验是,它确实得到了很好的优化。

My experience is that it is indeed very well optimized.

查看由EXPLAIN ANALYZE生成的您的查询的执行计划,您将看到它的实际成本是多少(然后进行比较)一个自写的递归函数)

Check out the execution plan for your query generated by EXPLAIN ANALYZE and you'll see how "costly" it really is (and then compare that e.g. to a self written recursive function)

这篇关于PostgreSQL具有递归性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆