Re: [PERFORM] index not being used when variable is sent

2011-08-17 Thread Jim Nasby
On Aug 17, 2011, at 1:49 AM, Eyal Wilde wrote: 1. is there any more elegant solution? Very possibly, but I'm having a heck of a time trying to figure out what your current code is actually doing. What's the actual problem you're trying to solve here? -- Jim C. Nasby, Database Architect

Re: [PERFORM] index not being used when variable is sent

2011-08-16 Thread Tom Lane
Eyal Wilde e...@impactsoft.co.il writes: CREATE OR REPLACE FUNCTION test_func(STR text) ... perform t1.val FROM t1 WHERE (COALESCE(rpad(t1.val, 100),'') ) like COALESCE(STR || '%','') order by COALESCE(rpad(t1.val, 100), '') using ~~ LIMIT 5; [ doesn't use index ] No, it doesn't. The LIKE