Is Pagination in memory?

Hi you all,

I have an app where I have to show the data of a table whose size is
around one millions of rows every day. Obviously, I will have to do
pagination. However, I was wondering how Pagination really works. Does
it just really fetch x records at a time? Or does it take eeeevery raw
and then do the pagination somehow in memory?

I suppose is the first one… but I don’t know if database stores like
MySQL has this feature to operate with.