But I am wrong about seeking the disk for the new value, it only checks the l3 cache which is still kinda fast |
I think you're confusing the CPU cache, which:
* Caches the contents of RAM and
nothing else.
* Is very tiny compared to RAM, typically a few megabytes at most.
* Has a fixed size.
* Exists physically either on the CPU itself or on the motherboard but close to the CPU and separately from RAM.
* Its contents are maintained by the CPU's logic.
with the disk cache, which:
* Caches the contents of all storage devices (hard disks, floppies, SSDs, etc.) that have been configured to be cached.
* Is tiny compared to the total sum storage in the system. Usually a few gigabytes at most (depending on available memory and competing allocation pressures).
* Has a variable (although bounded) size.
* Doesn't exist physically, or even necessarily. It's a software feature.
* Its contents are maintained by the OS logic.
> it is common knowledge that sql servers automatically use 100% of your ram
Huh? Source? If that were the case, boy would my software be throwing a bunch of allocation errors. |
No, that's actually true, somewhat. A typical DBMS such as MySQL or PostgreSQL will try to cache as much of the DB as possible in a breadth-first sort of fashion, starting with the indexes (which are B-trees) and finally with the data, until the DB behaves as if it lives in RAM, or all RAM has been allocated. This is a similar allocation philosophy as used by the disk cache. "Free RAM is wasted RAM".
I don't know what happens if the DBMS has to shared the system with a RAM-intensive application, whether they both start to thrash or whether the DBMS is able to detect this condition and throw bits of the cache away, again, similar to how the system's disk cache does things.