Regards,
Miro
I am aware of cache for generated columns. You didn't address the question
of generating a hash key in a DPF (Data Partitioning Feature) database. My
question was about the how much extra overhead is there for doing this.
The following doc suggests that there is a 198% "degradation" for generating
the identity column used as a hash partitioning key in DPF. See page
Sorry, didn't finish the above post.
Here is the link (See page 35):
ftp://ftp.software.ibm.com/software/data/pubs/papers/loaderperf.pdf
C1 INTEGER GENERATED ALWAYS AS IDENTITY in partitioning key 1909 sec
(198�2)%.
198% degradation means the load runs 3 times as long. Granted, this was for
DB2 Version 8.1, but unless I find some other documentation to the contrary,
I will assume there is still a big penalty even if not still 3 times as
long. Even a 50% degradation is significant when having to load many
millions of rows.
Miro
I think that this is an edge case. Using the database to generate a
surrogate key that is part of the table's partitioning key is clearly
not a best (or even recommended) practice. In fact, the DB2 optimizer
guys in Toronto will tell you that using a surrogate key instead of a
natural key isn't even best practice.
I'm not Joe Celko, so if you have to use a surrogate key the world won't
end, but there are much better ways to generate values than using an
identity column. All ETL tools have this, or you can even do it at
the UNIX level. For example (assuming you have a comma-delimited
input file, and you want to prepend the surrogate key to the existing
data):
mkfifo named_pipe
awk -F '{print NR, "," $0}' inputfile > named_pipe &
db2 "load from named_pipe of del insert into fact_table"
If you want to start with something other than 1, replace "NR" in the
awk statement with "NR+x" where x is the offset...