Zdenek Kotala napsal(a):
Martijn van Oosterhout wrote:
On Wed, Aug 23, 2006 at 10:26:19AM +0200, Zdenek Kotala wrote:
5) Tuples
question: Does have data types some disk representation?
Does have tupleheader same structure?
I think only the inet/cidr types changed format this release. Ways to
handle that have been discussed:
1. Have server contain code for old versions under old OID. This was
mentioned as a possibility.
2. ALTER TYPE ALTER TYPE from old to new type, possibly using text as
intermediary.
3. Fiddle with bits on disk (not sure if this is even possible)
It looks like that name is same but data representation is different.
I'm not sure if possible use same data type names with different OID. I
think there is unique index. We can rename this type to inet_old, but
some application should confused. I quickly looked in network.c and It
looks that data size is same (4 or 16). Option 3 is possible in this
case and I should be easy to implement it.
Does anybody know what exactly has been changed?
I examined ODS (on disk structure) and inet/cidr use 1byte less size for
storage information. PG8.1 uses two bytes for store INET type value
instead PG8.2 uses only one byte. I did not find any other change in
these types related to the ODS.
Because, attribute size is smaller then in the previous version, direct
tuple "compact" is possible. We can move part of tuple one byte left and
decrease size of tuple in the ItemIdData list for each not null
occurrence inet/cidr attribute in the tuple. I'm working on a prototype.
Indexes contain inet/cidr data type will be recreated by REINDEX command
or dropped on the old version and create again on the 8.2.
Zdenek
PS: There is attribute difference between 8.1 and 8.2
tuple1 = 1.2.3.4/24
tuple2 = 2001:4f8:3:ba:2e0:81ff:fe22:d1f1/128
Postgres 8.2
1) Offset=8152 Size= 38 xmin=1217 cmin=0 xmax=0
cmax=0 natts=1 info=902h hoff=28 ctid=(0/1)
0a 00 00 00 02 18 01 02
03 04
2) Offset=8100 Size= 50 xmin=1219 cmin=0 xmax=0
cmax=0 natts=1 info=902h hoff=28 ctid=(0/2)
16 00 00 00 03 80 20 01
04 f8 00 03 00 ba 02 e0
81 ff fe 22 d1 f1
Postgres 8.1
block= 0 pd_lsn=16278166570008576 pd_tli=1 pd_lower=32 pd_upper=8048
pd_special=8192 page_size=8192 page_version=3
1) Offset=8152 Size= 39 xmin=594 cmin=0 xmax=0
cmax=0 natts=1 info=902h hoff=28 ctid=(0/1)
0b 00 00 00 02 18 00 01
02 03 04
3) Offset=8048 Size= 51 xmin=1338 cmin=0 xmax=0
cmax=0 natts=1 info=902h hoff=28 ctid=(0/3)
17 00 00 00 03 80 00 20
01 04 f8 00 03 00 ba 02
e0 81 ff fe 22 d1 f1
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster