Hello,

I have an integration of ubercart with uc_affiliate2 and I need to use primary_email field for some queries - so would be good to make index for it. And I use it for example when I need to connect created by ubercart user with his affiliate in hook_user_insert. This hook happened before ubercart updated uc_order with relevant UID so I using primary_email to get order.

This is example of query:

SELECT uao.aid
FROM {uc_affiliate2_orders} uao
INNER JOIN {uc_orders} uo ON uao.order_id = uo.order_id 
AND uo.primary_email = '%s'
LEFT OUTER JOIN {uc_affiliate2_users} uau ON uao.aid = uau.aid 
AND uo.uid = uau.uid 
WHERE uau.aid IS NULL

What do you think about it?

Thanks,
Vadim

Comments

tr’s picture

Status: Active » Closed (won't fix)

As this is something only needed for uc_affiliate, I'd rather not add the index to the uc_orders table. I think that query could be re-written to be more efficient, and/or uc_affiliate can modify the uc_orders table and add the index when uc_affiliate is installed.