You can setup which items shall be persisted an in which way.
For rrd4j, at minimum you’ll have to use everyMinute strategy, you can add everyChange to get more accurate data.
In openHAB up to OH3.x, you would have to setup via text file /etc/openhab/persistence/rrd4j.persist (default path for GNU/Linux) You can get a demo file here:
(second java block)
In openHAB4.x you can use Main UI → Administration → Settings → (left Column) Persistence → rrd4j and add the items to be persisted.
If rrd4j.persist exists (and is valid), Main UI is read only for this feature (unlike other functions, which may work in coexistence via text and UI).
rrd4j is not the only other option. You can use pretty much any persistence engine for this except mapdb.
As @Udo_Hartmann mentioned, you have full control overv what gets saved to which persistence engine and when through the persistence config.
But I also want to mention, if your concern is size, rrd4j requires < 1MB per Item, forever. It’s a fixed sized database so it’s never going to take more than that.