I'm learning database at this time -- and a few of the queries are becoming simply crazy. I understand that throughout query optimisation you might sometimes rewrite queries diversely to reduce some things; I am searching in a correllated subquery example and find out it leads to exactly the same resultset like a LEFT JOIN.

I'm convinced that possibly mathematically (set theory) they might be related, and when someone confident with set theory would have the ability to observe that easily.

My real question is: What type of roi would I see from learning set theory? Would any roi? Will it be faster to understand database simply by writing more queries, or must i spend some time on set theory? I'd rather not fall lower a rabbit hole. I wish to be great with database, but I have to make it happen as quickly as possible.

This is a tricky question. I have taken courses in set theory and relational algebra in school, and that i can certainly say they have assisted my knowledge of relational databases. But simply learning set theory alone most likely will not be very convenient. Relational algebra, which takes a little fundamental set theory, is really a better formalism for modeling relational databases (by design), and it is an excellent factor to understand if you are thinking about with them a great deal. It can help without only query optimisation but additionally database design, which could appear just like a black art without analyzing the theoretical underpinnings. Database normal forms, for instance, could be succinctly describes as basic expressions in relational algebra.

If you are only doing simple SQL querying with no complex queries or database design, then your effort to understand relational algebra might not be justified through the benefit.

It's worth mentioning that real-world relational databases aren't really sets, but instead bags or multisets. Using set theory to bags has a tendency to cause head aches in the impedance mismatch.

The book, Database thorough - Relational Theory for Professionals, by C.J. Date may well be a good read for you personally. It's mostly theory-based, but examines it poor databases.

It may be a little dry sometimes, and Mr. Date includes a inclination to rail from the firms that build RDBMS platforms, but when you are searching to tie set theory for your learning process, this ought to help.

"Will it be faster to understand database simply by writing more queries, or must i spend some time on set theory? I'd rather not fall lower a rabbit hole. I wish to be great with database, but I have to make it happen as quickly as possible.Inch

Basically may take that last sentence literally, then I only say start studying theory. Set theory, relational algebra, type theory, calculus, the hyperlink with predicate logic, theory of normalization, ...

There's enough to help keep you studying not less than ten years, and also to me, that appears indeed an acceptable estimate of "the quickest possible" to obtain REALLY good with databases.

If you feel you'll be able to be a genuine database expert within one year's time, then you're just, well, plain fooling yourself.

If by "set theory" you mean understanding intersection, union, difference, and so forth, then certainly, it can help to know individuals basic principles. It should not get you lengthy, and will also be worthwhile.

Do not get depressed by axioms or infinities, etc.

Relational databases are made on set theoretic fundamentals (for instance, the main reason there is no guarantee around the order of rows happens because it's some records came back, unless of course you utilize a purchase BY).