Is there any index with O(1) complexity for lookup in PostgreSQL? Is there any index type in PostgreSQL that gives O(1) complexity for lookups? on strings?
You'll need to the read the PostgresSQL Index Types documentation for the version that you are using. I think you are looking for a Hash Index, but as as the documentation explains the real world performance and pros and cons depend on the implementation details and recommendations of the particular version that you are using.