-1

Right now I have implemented following algorithm in java for determining all possible candidate keys which is working fine. The link is below:-

http://shubhamshoundic.blogspot.com/2012/08/an-algorithm-to-find-all-possible.html

But in worst case, i.e., if all attributes are present on both sides of the FD (as in case M defined in above link), the number of FD which can be handled are reduced to 12 or 13 .

Reason is limited heap space in java. Following error is being thrown:-

OutOfMemoryError

My request is to help me is in implementing such algorithm which will have simpler complexity (Right now its exponential) to improve the number of FD being handled to at least 20.

Should I try to calculate it using multiprocessing or should I shift to another language rather than java.

GRaw
  • 1
  • 1

1 Answers1

1

It is known from 1978, and presented in all good books on databases, that the problem of finding all the keys requires an algorithm which has an exponential complexity in the worst case (see for instance: Lucchesi, C. and Osborn, S. (1978). Candidate keys for relations. Journal of Computer and System Sciences, 17(2):270–280). Moreover, the problem of finding if an attribute is prime is NP Complete.

This is due to the fact that the number of possible keys is itself exponential with the number of attributes or factorial with the number of functional dependencies.

So, it is impossible to find an algorithm polynomial with the number of attributes or of the functional dependencies.

Renzo
  • 26,848
  • 5
  • 49
  • 61
  • Thanks Sir. I means that I should not try to think this way. Will multiprocessing working parallel help here. – GRaw Aug 30 '16 at 15:06