1. Ruslan Zasukhin
  2. Valentina Database ADK
  3. Понедельник, Октябрь 31 2016, 10:03 AM
  4.  Подписаться через email
Okay, this thread is ANSWER to another thread with question.
I am starting it to give useful information. I think later we need some article about this.

So Jurriaan have show me book "Neo4J in Action" where on the first page there discuss troubles of Relational Model, SQL joins and mySQL in particular to solve GRAPH tasks, when you have Table - RecursiveLink (MM table in mySQL).

I should say this pages contains few mistakes or wrong claims.

For example,

Inefficiency of SQL joins
To find all a user’s friends at depth 5, a relational database engine needs to generate the Cartesian product of the t_user_friend table five times. With 50,000 records in the table, the resulting set will have 50,0005 rows (102.4 × 1021), which takes quite a lot of time and computing power to calculate. Then you discard more than 99% to return the just under 1,000 records that you’re interested in!


I think even mySQL do not make join in such way. Valentina DB than more.
This is description of theoretical the most stupid simple algorithm.

In the same time, they show benches of mySQL with HUGE degradation.
And this can be easy true.

But, this is not problem of SQL or Joins or Relational model.
This is just a lack in mySQL of recursive commands.

Oracle have such commands. Valentina DB have such commands also, and even better of Oracle, thanks to our BinaryLinks.

They are describe in our article Hierarchical (Recursive) Queries in Valentina SQL
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
mySQL Example from Book:

create table t_user (
id bigint not null,
name varchar(255) not null,
primary key (id)
);
create table t_user_friend (
id bigint not null,
user_1 bigint not null,
user_2 bigint not null,
primary key (id)
);
alter table t_user_friend
add index FK416055ABC6132571 (user_1),
add constraint FK416055ABC6132571
foreign key (user_1) references t_user (id);
alter table t_user_friend
add index FK416055ABC6132572 (user_2),
add constraint FK416055ABC6132572
foreign key (user_2) references t_user (id);



The same task in Valentina DB

create table t_user (
name varchar(255) not null
);

CREATE BINARY LINK linkFriends ON TABLES ( t_user, t_user ) AS MANY TO MANY
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Why our recursive implementation is better of Oracle? Few reasons...

1) Valentina have VERTICAL storage format of tables and each table has automatic RecID field.

2) Valentina have BinaryLink, which stores just pair { RecID1, RecID2 }.

This link is smaller and faster than "standard" MM-Table from Relational Model. As result we can do joins faster even for simple join.

3) Oracle can do search UP and DOWN. Valentina can do search WIDE (brothers).

NOTE: a brother of X-record is a Y-record, which is a child of the same parent-record.
Комментарий
There are no comments made yet.
  • Страница :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.