@@ -120,7 +120,7 @@ Merge two adjacent RANGE partitions. Data from `partition2` is copied to `partit
120
120
```
121
121
append_range_partition(p_relation TEXT)
122
122
```
123
- Appends new RANGE partition and returns
123
+ Appends new RANGE partition and returns
124
124
```
125
125
prepend_range_partition(p_relation TEXT)
126
126
```
@@ -160,6 +160,13 @@ disable_partitioning(relation TEXT)
160
160
Disables` pg_pathman ` partitioning mechanism for the specified parent table and removes an insert trigger. Partitions itself remain unchanged.
161
161
162
162
##Examples
163
+
164
+ ###Common tips
165
+ You can easily add** _ partition_ ** column containing the names of the underlying partitions using the system attribute called** _ tableoid_ ** :
166
+ ```
167
+ SELECT tableoid::regclass, * AS partition FROM partitioned_table;
168
+ ```
169
+
163
170
###HASH
164
171
Consider an example of HASH partitioning. First create a table with some integer column:
165
172
```
@@ -180,13 +187,13 @@ This will create new partitions and move the data from parent to partitions.
180
187
Here is an example of the query with filtering by partitioning key and its plan:
181
188
```
182
189
SELECT * FROM items WHERE id = 1234;
183
- id | name | code
190
+ id | name | code
184
191
------+----------------------------------+------
185
192
1234 | 81dc9bdb52d04dc20036dbd8313ed055 | 1855
186
193
(1 row)
187
194
188
195
EXPLAIN SELECT * FROM items WHERE id = 1234;
189
- QUERY PLAN
196
+ QUERY PLAN
190
197
------------------------------------------------------------------------------------
191
198
Append (cost=0.28..8.29 rows=0 width=0)
192
199
-> Index Scan using items_34_pkey on items_34 (cost=0.28..8.29 rows=0 width=0)
@@ -195,7 +202,7 @@ EXPLAIN SELECT * FROM items WHERE id = 1234;
195
202
Note that pg_pathman excludes parent table from the query plan. To access parent table use ONLY modifier:
196
203
```
197
204
EXPLAIN SELECT * FROM ONLY items;
198
- QUERY PLAN
205
+ QUERY PLAN
199
206
------------------------------------------------------
200
207
Seq Scan on items (cost=0.00..0.00 rows=1 width=45)
201
208
```