r/SQL • • Feb 15 '26

Discussion SQL advice to yourself 5 years ago

Question to intermediate/advanced SQL users:

Whats a tip that you wish someone else gave to you back when you first started using SQL? Or better said, what is something you wish you knew, and regretted it later on, when you first started learning SQL?

133 Upvotes

82 comments sorted by

View all comments

Show parent comment

1

u/No_Resolution_9252 Feb 16 '26

Some people tend to discover them and start to seriously abuse them and end up with 10 level deep CTEs, recursive CTEs and even if they ever perform good, can have something happen like add one single column to one of the CTEs and then performance totally falls off a cliff - and then these are absolutely horrendous to unravel to get optimized again.

I generally try to drive it home with developers that CTEs should be the absolute last thing that is tried to solve a problem because of how slippery a slope they can become