When you use iCloud photos - all your photos are still stored in the library on your mac. Icloud is a sync service, not a backup service. It will create an identical library across all of your apple devices.
If you delete photos on your mac, they will also be deleted in iCloud.
If you want to reduce the space taken by photos on your mac:
You have two options.
1 (easiest). Turn on "Optimise Mac Storage" in iCloud settings. This will mean the mac only stores small previews locally and full size images in the cloud. It will dramatically reduce the space used by your library.
There are two provisos with this - The first is that it won't immediately remove full size images from your mac - it will only do that when it thinks you are running out of space. There is a way to force it to remove the local copies immediately described in this user tip:
https://discussions.apple.com/docs/DOC-250002222
Backups become a problem, since the full size images are not stored on your mac you can't copy the library to a backup drive, and time machine cannot back them up. So if you go this way, you really need to set up an additional user account also synced to iCloud but with the library on an external disk - and fully syncing (not optimising storage). Then you have an additional local copy of the full library which can now be backed up. (you would need to periodically log into that account, and allow it to sync with iCloud) (See also option 2)
2 - Your other option is to completely move the library to external storage with the disadvantage that you must have the external storage connected whenever you want to use photos.
To correctly prepare the external drive:
It must be formatted APFS or MacOS extended (journaled) (preferred for spinning drives)
It Must not be (or have been) used for time machine.
It must have the 'ignore ownership" checkbox ticked.
It should not be on a memory stick, SD or similar.
It must also not be a network drive (a direct connection is required - eg USB or Thunderbolt).
File sharing services such as iCloud Drive, Drop box, Onedrive etc are not compatible with Photos libraries.
It stands to reason that if you want any sort of reasonable performance it should be a fast drive with a fast connection.
It must also not be a network drive (a direct connection is required - eg USB or Thunderbolt). File sharing services such as iCloud Drive, Drop box, Onedrive etc are not compatible with Photos libraries.
See
https://support.apple.com/en-gb/HT201517