Self-organizing database