cancel
Showing results for 
Search instead for 
Did you mean: 

Add an option to DBUNLOAD to export data in primary key order

VolkerBarth
Contributor
2,305

I'm using the output of DBUNLOAD to compare databases before and after migrations, including the unloaded data. That usually works fine.

However, now and then, the diff tool displays differences for some tables, and that seems to be due to the fact that these tables have (non-unique) clustered indexes that do not build the primary key - and therefore may order data non-deterministically. Well, that's documented behaviour:

ORDER clause With ORDER ON (the default), the exported data is ordered by clustered index if one exists. If a clustered index does not exist, the exported data is ordered by primary key values.

I do understand that this default order makes sense particularly to speed up the reload. And of course I can do separat "UNLOAD SELECT * FROM myTABLE ORDER BY MyPk" statements to unload data in the desired order.

However, if would be nice if DBUNLOAD would have an option (say, "-up") to always use primary key (or at least an unique clustered key) to order the output.


To add: Since DBUNLOAD certainly makes use of the UNLOAD TABLE/MATERIALIZED VIEW statement, the suggested enhancement would apply to that, as well.

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

Your suggestion is noted. However we would not be able to use the -up switch for dbunload since this switch is already defined to mean "unload passwords" in v17. We'll pick something else (perhaps -uk for "unload by [primary] key"?)

I've added this to our future enhancements list.

Thanks for the suggestion.

Answers (0)