What is the difference in writing something like this:
SET SCHEMA 'schema';
SELECT table2.field1,
table2.field2,
table2.field3,
table2.field4,
table2.field5,
table2.field6
FROM table2
WHERE table2.field1 LIKE '%{$search}%' and table2.field2 LIKE '%{$search2}%' and table2.field3 LIKE '%{$search3}%' and table2.field4 LIKE '%{$search4}%' and (table2.field5 ~* '{$search5}' {$radioa} table2.field6 ~* '{$search6}')
ORDER BY table1.field1 DESC, table1.field2 LIMIT {$radiob};
And something in plpgsql? What I mean is will I benefit in speed or efficiency anymore if I translated the above to plpgsql? Should I stick to the bland, dynamic statement in PHP, or go bananas with plpgsql?