Part II. The SQL Language
This part describes the use of the SQL language in Postgres Pro. We start with describing the general syntax of SQL, then explain how to create the structures to hold data, how to populate the database, and how to query it. The middle part lists the available data types and functions for use in SQL commands. The rest treats several aspects that are important for tuning a database for optimal performance.
The information in this part is arranged so that a novice user can follow it start to end to gain a full understanding of the topics without having to refer forward too many times. The chapters are intended to be self-contained, so that advanced users can read the chapters individually as they choose. The information in this part is presented in a narrative fashion in topical units. Readers looking for a complete description of a particular command should see Part VI.
Readers of this part should know how to connect to a Postgres Pro database and issue SQL commands. Readers that are unfamiliar with these issues are encouraged to read Part I first. SQL commands are typically entered using the Postgres Pro interactive terminal psql, but other programs that have similar functionality can be used as well.
Table of Contents
- 4. SQL Syntax
- 5. Data Definition
- 6. Data Manipulation
- 7. Queries
- 8. Data Types
- 8.1. Numeric Types
- 8.2. Monetary Types
- 8.3. Character Types
- 8.4. Binary Data Types
- 8.5. Date/Time Types
- 8.6. Boolean Type
- 8.7. Enumerated Types
- 8.8. Geometric Types
- 8.9. Network Address Types
- 8.10. Bit String Types
- 8.11. Text Search Types
- 8.12. UUID Type
- 8.13. XML Type
- 8.14. JSON Types
- 8.15. Arrays
- 8.16. Composite Types
- 8.17. Range Types
- 8.18. Object Identifier Types
- 8.19. pg_lsn Type
- 8.20. Pseudo-Types
- 8.2. Monetary Types
- 8.1. Numeric Types
- 9. Functions and Operators
- 9.1. Logical Operators
- 9.2. Comparison Functions and Operators
- 9.3. Mathematical Functions and Operators
- 9.4. String Functions and Operators
- 9.5. Binary String Functions and Operators
- 9.6. Bit String Functions and Operators
- 9.7. Pattern Matching
- 9.8. Data Type Formatting Functions
- 9.9. Date/Time Functions and Operators
- 9.10. Enum Support Functions
- 9.11. Geometric Functions and Operators
- 9.12. Network Address Functions and Operators
- 9.13. Text Search Functions and Operators
- 9.14. XML Functions
- 9.15. JSON Functions and Operators
- 9.16. Sequence Manipulation Functions
- 9.17. Conditional Expressions
- 9.18. Array Functions and Operators
- 9.19. Range Functions and Operators
- 9.20. Aggregate Functions
- 9.21. Window Functions
- 9.22. Subquery Expressions
- 9.23. Row and Array Comparisons
- 9.24. Set Returning Functions
- 9.25. System Information Functions
- 9.26. System Administration Functions
- 9.27. Trigger Functions
- 9.28. Event Trigger Functions
- 9.2. Comparison Functions and Operators
- 9.1. Logical Operators
- 10. Type Conversion
- 11. Indexes
- 11.1. Introduction
- 11.2. Index Types
- 11.3. Multicolumn Indexes
- 11.4. Indexes and
ORDER BY
- 11.5. Combining Multiple Indexes
- 11.6. Unique Indexes
- 11.7. Indexes on Expressions
- 11.8. Partial Indexes
- 11.9. Operator Classes and Operator Families
- 11.10. Indexes and Collations
- 11.11. Index-Only Scans
- 11.12. Examining Index Usage
- 11.13. Using k-NN Algorithm for Optimizing Queries
- 11.2. Index Types
- 11.1. Introduction
- 12. Full Text Search
- 12.1. Introduction
- 12.2. Tables and Indexes
- 12.3. Controlling Text Search
- 12.4. Additional Features
- 12.5. Parsers
- 12.6. Dictionaries
- 12.7. Configuration Example
- 12.8. Testing and Debugging Text Search
- 12.9. GIN and GiST Index Types
- 12.10. psql Support
- 12.11. Limitations
- 12.12. Migration from Pre-8.3 Text Search
- 12.2. Tables and Indexes
- 12.1. Introduction
- 13. Concurrency Control
- 14. Performance Tips
- 15. Parallel Query
- 16. Autonomous Transactions