mysql和postgres的比較(待續)

1.  postgres不支持列順序重排,除非重建表;而mysql可以說alter table mytable add column after column。
2. 刪除列是,postgres其實是把這個列隱藏了,並沒有真正刪除,而mysql能真正刪除。此外,mysql還提供optimize table,repair table和analyze table等工具分析和改善數據表的存儲狀況。
The DROP COLUMN form does not physically remove the column, but simply makes it invisible to SQL operations. Subsequent insert and update operations in the table will store a null value for the column. Thus, dropping a column is quick but it will not immediately reduce the on-disk size of your table, as the space occupied by the dropped column is not reclaimed. The space will be reclaimed over time as existing rows are updated
3. mysql的權限精確到數據表中的每個列,而postgres只能精確到表或者同級別的視圖、函數、觸發器等。
You can restrict access to individual columns of a table for a particular user or group by denying them direct access to it, and creating a view containing only the columns they should see for them to use instead. If your users need to update the data, you can create rules to apply updates to the view to the base table instead.
4. mysql支持同時插入多條紀錄:insert into table values (), (), ();,爲了避免重複插入主鍵相同的紀錄還可以用replace into。而postgres只能插入一條,如果要插入多條紀錄,可以使用COPY語句。至於mysql的replace和insert ... on duplicate key update等擴展的語法,可以用postgres的觸發器來實現。

以後添加更多的比較
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章