Table of Contents
Binary Link Advantages
Binary Link have a lots of advantages over ObjectPtr and, than more, over FOREIGN KEY.
Tables are not "Infected"
On the following pictures you can see that using Binary Link you can avoid KEY and PTR fields in your tables absolutely. Your Tables are not “infected” any more by data of links!
- pict1 - Foreign Key Structure
- pict2 - ObjectPtr Structure
- pict3 - Binary Link Structure
Simpler Structure Design
Since Binary Link does not add into Tables any additional fields, you get more clean and simple structure of your tables. Tables contain only custom fields.
The following pictures underline this advantage visually. The more Links you have in your database the simpler Tables become. You can see that if you use Binary Link, then Tables have only custom fields.
But it is even more important that now you can easily add/remove links between Tables and this will not affect structure of existed tables.
Less Disk/RAM Usage
Another Example. Here we have five tables which should be linked as M : M. Using relational model or even ObjectPtr fields, developer should create 4 Tables that play role of links.
Now compare to the second picture where this task is solved using BinaryLinks. You have now only five tables instead of nine. But yes. You have now 4 BinaryLink objects.
Have you win something? Answer is YES.
Because BinaryLink uses about 25% less of disk space than MM Table-Link so it is at least 25% times faster thanks to size. In reality it is even more fast because of other algorithms to be used. See below…
Simpler SQL Queries
Assume you have tables Person and Phone. You need establish M:M link between these objects.
Relational solution
You make third table Person_Phone that play role of M:M link. To get join of some Persons and their Phones you do SQL like this:
SELECT Person.*, Phone.* FROM Person pr JOIN PersonPhone pp ON pr.id = pp.person_ptr JOIN Phone ph ON pp.phone_ptr = ph.id
Now take a look how much simpler this query is if we use Binary Links:
SELECT Person.*, Phone.* FROM Person JOIN Phone ON Person_Phone
With Valentina you can even skip the link specification, if you know that there is only one link-path between tables:
SELECT Person.*, Phone.* FROM Person JOIN Phone
Faster Join Speed
The most visible reason why join based on MM Binary Link will be faster than join based on MM Table you can see from the above two SQL queries. You can see that for Binary Link requires only on join operations between Person and Phone tables, but MM Table requires 2 joins. It is easy to see that cost of these two joins is comparable. So we can expect at least 2 times faster speed for Binary Link join.
For Binary Link of 1 : M kind we will have the same join speed like for ObjectPtr-based join.