What are the challenges you face when working across database platforms? Take the survey

Random data issue

tkdennistkdennis Posts: 114
I have 2 child tables with Foreign Keys from the same parent table all using the same unique 3-column key. I'm trying to generate different rows in Child1 and Child2, but have not been able to do so.

Parent Rows 600,000 (already generated)
Child Rows 300,000

I have changed the seed values several times, changed the Population method to Repeat Key Values at Random or All Key Values Unique but I still get almost 100% the same keys in the two Child tables when I would expect 50% overlap if it were truly random.

I also tried different row counts and seeds:
Child row counts 100: 6 are duplicates
Child row counts 100, changed seeds: 7 are duplicates
Child row counts 1,000: 561 are duplicates
Child row counts 1,000, changed seeds: 545 are duplicates
Child row counts 10,000: 9496 are duplicates
Child row counts 10,000, changed seeds: 10,000 are duplicates

Am I doing something wrong??



  • Options
    The first 2 columns of the 3-part key are being selected by the Foreign Key generator in numerical order regardless of the Seed or Population method. For example:

    Table A (parent table, 600000 rows
    Key 1 - randomly numbered 1-999999)
    Key 2 - randomly numbered 1-10)
    Key 3 - randomly numbered 1-5)

    Table B (child table, Foreign Key to Table A on Key1, Key2, Key3)
    Trying to generate 100 rows of data for Table B randomly from Table A
    Key 1 - Sequentially numbering from Table A.Key1
    Key 2 - Sequentially numbering from Table A.Key2
    Key 3 - Randomly selecting values from Table A.Key3

    The Foreign Key generator is not randomly selecting rows from the 3-part composite key in Table A. It is running through Table A sequentially and deciding at random whether to take the row or not until it reaches the number of rows requested, which in this case is significantly less than the total rows available so only the first part of the Table A is ever processed.

    The app won't let me change the Foreign Key Generator on those columns. Is it possible to configure it in some way to get a truly random selection of rows from Table A?

  • Options
  • Options

    I'm really sorry for the delay in replying. Been trying to get head around your db structure.

    Could you please email me with your DB structure so we can discuss this offline.


Sign In or Register to comment.