How is PostgreSQL indexing strings and varchars?
Is it indexing the full “string” or only parts of it?
Until now I’ve assumed that it’s using the full string, but never really got it verified.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It uses the whole string. If you want to use only a part of a string you can always use an index on an expression. Like:
left()requires PostgreSQL 9.1 or later. For older versions: