I am using join in my quires and i want to know if the relations between database tables leads to increase performance of the queries.
Thank You.
I am using join in my quires and i want to know if the relations between database tables leads to increase performance of the queries.
Thank You.
For boosting performance, you should use indexes, use appropriate datatypes as well (storing number as string takes more space and comparing may be less efficient).
Relations between tables, i.e. foreign key are constraints, so you cannot enter new value to referenced table without referencing records in other table - it is a way to keep data integrity, eg.
Table1
id table2_id
1 1
2 1
3 3
Table2
id some_column
1 123
2 123
3 null
Here, Table1.table2_id
references Table2.id
. Now you won't be able to insert such row to Table1
: 4, 4
, because there's no id = 4
in Table2
.