Almost forgot: one fo the heavier select query can be: ----- SELECT contact.id, contact.company_id, contact.name AS nome, contact.surname AS cognome, contact.email AS email, contact.company_name AS azienda FROM contact WHERE ( lower(contact.company_name) LIKE 'smit%' OR lower(contact.name) LIKE 'smit%' OR lower(contact.surname) LIKE 'smit%' OR contact.phone LIKE 'smit%' OR lower(contact.code) LIKE 'smit%' OR lower(contact.email) LIKE 'smit%' ) ORDER BY contact.company_name ASC, contact.company_id DESC ----- And this is the queyr plain: http://explain.depesz.com/s/Il -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general