1st off, don't fret too much. Some people learn x and think they know it all. You and I learn x and realise we don't know a, b, c, d... and lose confidence. Don't.
> I don't know how databases work,
Many DB/SQL programmers don't either, and they may have worled for years. I worked on several projects where it was clear the other DBs didn't understand the tech, and didn't even understand SQL that well (like not knowing transaction isolation levels and releasing code with race conditions in thereby).
> I don't know what exactly ray tracing is
Who cares.
> So, how can one effectively fill gaps in their CS knowledge?
You're confusing computer science with programming/development. They are different. My advice, you can't know everything (I tried and failed) so go for a broad niche (web dev + UIs, or back-end dev + databases). BTW for learning there are huge resources now that never existed when I started. Just hit DDG a few phrases ("how do databases work") and go from there.
Relax a bit, and good luck!