I created indexes in postgres for the below mentioned table using md5. The indexes and the table are given below:
create table my_table(col1 character varying, col2 character varying, col3 character varying);
my_table looks like (I have just given an example. My actual table is of 1Tera Byte):
col1 col2 col3
<a12> <j178> <k109>
create index index1 on my_table (md5(col1), md5(col2), md5(col2));
I tried to create index without using md5, however I ended up getting the error:
ERROR: index row size 2760 exceeds maximum 2712 for index "index1"
HINT: Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
However, I notice that my query processing time remains the same whether I had created index or not. I am confused as to what could be the reason. Can someone please help me with this?
The sql query which I have fired is of the form:
select col3 from my_table where col1='<a12>' and col2='<j178>';
md5? What do you think it means?