tailieunhanh - Beginning Databases with Postgre SQL phần 6

Chúng ta đã thấy rằng PostgreSQL cung cấp cho nhiều nhà khai thác và các chức năng mà chúng ta có thể sử dụng để tinh chỉnh các truy vấn và trích xuất thông tin. Các ngôn ngữ thủ tục được hỗ trợ bởi PostgreSQL cho phép chúng ta phát triển khá tinh vi phía máy chủ xử lý bằng cách viết các thủ tục PL / pgSQL, SQL, | CHAPTER 10 FUNCTIONS STORED PROCEDURES AND TRIGGERS 307 Summary In this chapter we looked at ways in which we can extend the functionality of PostgreSQL queries. We have seen that PostgreSQL provides many operators and functions that we can use to refine queries and extract information. The procedural languages supported by PostgreSQL allow us to develop quite sophisticated server-side processing by writing procedures in PL pgSQL SQL and other languages. This provides the opportunity for the database server to implement complex application functionality independently of the client. Stored procedures are stored in the database itself and may be called by the application or in the form of triggers called automatically when changes are made to database tables. This gives us another means of enforcing referential integrity. For simple referential integrity it s generally best to stick to constraints as they are more straightforward efficient and less error-prone. The power of triggers and stored procedures comes when your declarative constraints become very complex or you wish to implement a constraint that is too complex for the declarative form. Now that we have covered some advanced PostgreSQL techniques in the next chapter we will move on to the topic of how to care for a PostgreSQL database. CHAPTER 11 PostgreSQL Administration I n this chapter we will look at how to care for a PostgreSQL database. This covers items ranging from configuring access to the system through managing the placement of database files maintaining performance and crucially backing up your system. As we progress through this chapter we will cover the following topics System-level configuration of a PostgreSQL installation Database initialization Server startup and shutdown User and group management Tablespace management Database and schema management Backup and recovery Ongoing maintenance of a PostgreSQL server While learning and experimenting with these administrative tasks you will want .