Re: [PERFORM] Number of characters in column preventing index usage

2017-02-17 Thread Hustler DBA
Thanks you guys are correct... the size of the table caused the optimizer to do a seq scan instead of using the index. I tried it on a 24 MB and 1 GB table and the expected index was used. On Fri, Feb 17, 2017 at 7:04 PM, Tom Lane wrote: > "David G. Johnston" writes: > > On Fri, Feb 17, 2017

Re: [PERFORM] Number of characters in column preventing index usage

2017-02-17 Thread Hustler DBA
, Feb 17, 2017 at 5:52 PM, Tomas Vondra wrote: > On 02/17/2017 11:42 PM, David G. Johnston wrote: > >> On Fri, Feb 17, 2017 at 3:19 PM, Hustler DBA > <mailto:hustler...@gmail.com>>wrote: >> >> >> >> my_db=# create index tab_idx1 on tab(ID); &

[PERFORM] Number of characters in column preventing index usage

2017-02-17 Thread Hustler DBA
I am seeing this strange behavior, I don't know if this is by design by Postgres. I have an index on a column which is defined as "character varying(255)". When the value I am searching for is of a certain length, the optimizer uses the index but when the value is long, the optimizer doesn't use t