4

I have built a QlikView script generator (QVS), that can be used to generate large script files for data imports from SQL Server to QlikView.

QlikView does not like 'fully' normalised database structures (loops between several tables): for example, three tables A, B, C in SQL Server could have three PK/FK links; in QlikView it requires just two. So, I now have to 'denormalize', or remove the loops between tables...

Currently I am creating an 'exclusion table', which I traverse with an quad-imbedded for-loop, to isolate and remove constraints in the DB structure before generating the script file. This seems to work, but takes WAY too long as the number of tables can be large.

Is there another way that I can achieve what I want more economically?

Gangnus
  • 2,805
  • 4
  • 21
  • 31
MoonKnight
  • 169
  • 9
  • No real working database can ever be "fully" normalised. We are talking about a 2nd normal form standard. A fully normailised database is an phantom that I personally have never come accross... – MoonKnight Jan 16 '13 at 18:53
  • @Killercam: Did you try creating some intermediate tables holding the denormalized data? This is typically task which can be done by some sophisticated "SELECT INTO" statements or an optimized stored procedure. And if this is too slow, you should provide us with some more details about your data model (though this question may be better suited for SO then). – Doc Brown Jan 16 '13 at 19:21

1 Answers1

1

Standard algorithm for denormalization:

  1. Let's take that rows of A,B,C tables are linked in mn:n:1 proportion.

  2. Make three inserted cycles by each C by each appropriate B by each appropriate A.

  3. For each row in the inner cycle make a new row of the result table.

Gangnus
  • 2,805
  • 4
  • 21
  • 31