Hello and welcome.
Normally, that error message means there is data corruption or a failing hard drive.
-Which model Mac?
-Which version of OS X?
-Which version of Photos?
-How large is the Photos Library?
-Do you have any utilities to check the hard drive - i.e. TechTool Pro, Drive Genius, etc?
-Have you had any freezing or hanging issues recently with your internal or external drives?
C