从 mysql 迁移到 postgresql,我缺少的最佳功能是什么?
我以前都是用 mysql 开发所有东西,这周出现了使用 postgresql 的机会,为什么不呢!
我总是被告知 postgresql 有一个更大的功能集。
我读过一些维基百科,但大多数信息确实已经过时了。
我错过了哪些最好的功能?像部分索引等..
另外,我会错过mysql的一些东西吗?
I used to develop everything with mysql, this week an opportunity to work with postgresql appeared, why not!
I was always told that postgresql had a much bigger feature set.
I read some wikis, but most of the info are really outdated.
What are the best features I was missing? Like partial indexes, etc..
Also, I will miss something from mysql?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
最好的功能之一
用户定义的聚合:
CTE,支持递归
generate_series
窗口函数:
出色的日期函数
数组支持
更丰富的数据类型
在其上分组时对主键的功能依赖(在下一版本,9.1)
用户定义运算符
DISTINCT ON
LATERAL JOIN
使用 DOMAIN 的自定义数据类型
将整行传递给函数
One of the nicest feature of
User-defined aggregates:
CTE, supports recursion
generate_series
Windowing functions:
Superb date functions
Array support
Richer data types
Functional dependency on primary keys when grouping on it (on next version, 9.1)
User-defined operator
DISTINCT ON
LATERAL JOIN
Custom data type using DOMAIN
Passing the whole row to function
不要忘记 DDL,它也是事务安全的:
非常适合维护工作,即使您失去数据库连接或服务器出现故障,您也将始终拥有一致的数据库。
And don't forget the DDL, it's also transaction safe:
Great for maintenance work, you will always have a consistent database, even when you lose the database connection or the server goes down.
除了 Michael 的列表(其中我最喜欢窗口函数)之外
select * from my_func(42)
部分索引 (CREATE INDEX) idx1 ON some_table (some_column) WHERE some_flag = true
)从 some_table where 42 删除
被认为是错误并且不会删除整个表In addition to Michael's list (of which I like windowing functions the most)
select * from my_func(42)
CREATE INDEX idx1 ON some_table (some_column) WHERE some_flag = true
)delete from some_table where 42
is considered an error and doesn't delete the whole table下面的链接列出了许多主要数据库产品之间的功能差异:
不同 SQL 实现的比较< /a>
Here's a link that lists out the difference in features between many of the major database products:
Comparison of different SQL implementations
全外部连接。缺乏这些是我对 MySQL 最大的抱怨之一。但 Postgresql 支持它们。
FULL OUTER JOINs. The lack of these is one of my biggest complaints about MySQL. But Postgresql supports them.