+ 2

Improve performance of SQL request

How do I improve the performances of an SQL request ? Do you have tips for that ? ps: sorry if I made spelling mistakes

23rd Feb 2018, 9:14 AM
Αητοιπe
Αητοιπe - avatar
3 Antworten
+ 2
Well write a better query or think about a better database layout for your project. Also narrow down your requests to a absolute minimum of data. Mostly queries slow down when you use a lot of unnecessary outer joins or compute values inside queries... But Google gives a lot of top 10 query checklists you could find interesting
23rd Feb 2018, 1:52 PM
Chrizzhigh
Chrizzhigh - avatar
+ 2
@Chrizzhigh Do you think classify data in differents tables will help to perform searching queries faster than store all the data in one table. For example having different tables, one for the elements where title begin with an 'A', an other one for elements where title begin with an 'B'... I don't know how data is stored in the database with huge data PS : thanks for your answer
23rd Feb 2018, 3:23 PM
Αητοιπe
Αητοιπe - avatar
+ 1
Mh... Usually the rule is to avoid null values and arrays. So for example if you have a song which has a id length title and album, album would be a candidate to get a own table because one album could have more titles and maybe some titles have no album. So you make a song a album and a album_song table. Speed of queries than depend highly on what you want to know. Something about indexing to speed up queries: https://stackoverflow.com/questions/17354219/how-to-speed-up-sql-queries-indexes Why you should not use only one table: https://stackoverflow.com/questions/36549354/a-large-one-table-with-100-column-vs-a-lot-of-little-tables
23rd Feb 2018, 5:32 PM
Chrizzhigh
Chrizzhigh - avatar