Greg Stark <gsst...@mit.edu> [2009-08-23 03:44]:
> 2009/8/22 Radoslaw Zielinski <ra...@pld-linux.org>:
>>  $ seq 11 | xargs -ti psql bug -c "select {}, (x).* from (select 
>> bt_page_items('promocje_pkey',{}) as x ) as y"
>>  [...]
>>  psql bug -c select 11, (x).* from (select bt_page_items('promocje_pkey',11) 
>> as x ) as y
>>  ERROR:  block number out of range

> Sorry, I forgot to adjust the index name in the example. We don't want
> the primary key index of your table we want the index of the toast
> table.

Sorry, I got confused by the index not being shown in \d 
pg_toast.pg_toast_29644.

> Try the same thing with bt_page_items('pg_toast.pg_toast_29644_index',...)

bug=# select * from bt_page_items('pg_toast.pg_toast_29644_index', 8) where 
data ~ 'a5 d7 01 00';
-[ RECORD 1 ]-----------------------
itemoffset | 121
ctid       | (458,3)
itemlen    | 16
nulls      | f
vars       | f
data       | a5 d7 01 00 00 00 00 00

Full output, without the WHERE: http://radek.cc/promocje_bpi2.txt.gz
get_raw_page( 'pg_toast.pg_toast_29644', 458 ): 
http://radek.cc/toast_29644_page_458.txt

bug=# select * from heap_page_items( get_raw_page( 'pg_toast.pg_toast_29644', 
458 ) );
 lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid  | 
t_infomask2 | t_infomask | t_hoff | t_bits | t_oid 
----+--------+----------+--------+--------+--------+----------+---------+-------------+------------+--------+--------+-------
  1 |   6156 |        1 |   2036 |   3816 |      0 |        1 | (458,1) |       
    3 |       2306 |     24 |        |      
  2 |   4176 |        1 |   1979 |   3816 |      0 |        1 | (458,2) |       
    3 |       2306 |     24 |        |      
  3 |      0 |        3 |      0 |        |        |          |         |       
      |            |        |        |      
  4 |   2140 |        1 |   2036 |   3823 |      0 |        0 | (458,4) |       
    3 |       2306 |     24 |        |      
(4 rows)

bug=# select * from bt_page_stats('pg_toast.pg_toast_29644_index', 8);
-[ RECORD 1 ]-+-----
blkno         | 8
type          | l
live_items    | 366
dead_items    | 1
avg_item_size | 16
page_size     | 8192
free_size     | 808
btpo_prev     | 7
btpo_next     | 9
btpo          | 0
btpo_flags    | 65

-- 
Radosław Zieliński <ra...@pld-linux.org>

Attachment: pgpxgxQ7s6Y9N.pgp
Description: PGP signature

Reply via email to