SQL Index and co.

SQL Index and co.

In research progress in development, we need to have a good structure of our DataBase. Today I will show you the importance of a great organisation in your Data!

His name is “index”.

First of all, what are the basics of this idea?

Based on: …

What that: Structured Query Language (SQL).

What for? Permit a communication with the database.

How? Allow to write scripts.

Ok, now we can begin :

First of all:

How to use index?

To fully understand following words, we need to keep in mind a picture of what is a database. Ok, close your eyes... after reading these lines please... Database it's like a book. You have pages, a lot of, index and views. Index regroups all information you need in small pages. Ok, now close your eyes and print it in your mind... It's ok, if you have an old page smell in your nose you can continue!

What for?

The index is here to find faster in searching.

That's why we can say: “An index makes the query fast”.

To find a specific information, you need to have the key. If you have it, the way will be faster.

Is it ok ? Now we can finally understand it !

	For beginners be carefull :

If you don't know what is SQL and why it's interesting to know it I recommand you : 
https://sql.sh/ (to know),
https://www.w3schools.com/mySQl/default.asp (to practice).

To understand the structure of this idea:

Grab the book in your mind and feel it in your hands… You have to know, DataBase is a live string between information. Every information is linked to two others, the preceding and the following, it’s a double link.

In example in PHP you have SplDoublyLinkedList class.

https://www.php.net/manual/fr/class.spldoublylinkedlist.php

With this you can manipulate elements:

No you can't! But if you know what's Balanced Search Tree (B-tree) you can. The B-tree is the database structure. If you want facility leave this way. Keyes are not organised like the alphabet. So you can't church in like it.

It's like a tree, you have root node the first choice, that's lead you to branch nodes. But here you can't see the sun and that's your goal. You have to reach the leaf to have your information. So it's oranised like this:

Root Node → Branch Node → Leaf Node.

With this struture it's imperative to have a balance tree. If you don't you will have a “Pisa” Tree.

Is it really good?

Yes, if you have a beatifull tree.

Surches have three steps:

-the tree transversal

-following the leaf node chain

-fetching the table data.

To finish, my feelings :

The important point, it's to keep in mind if there is one more table access for each row, the church will do all ways and take more and more time if there is more access.
Table creation is not easy, but if you want to create a good database, you have to well thought all steps.

To go far far away:

https://use-the-index-luke.com


Pierre Baudino

0
0

Laisser un commentaire