Speedy Sub-Queries??

  • Ya index tuning should be a daily task... reindex all the tables that meet a set treshold so that you don't have to do 'em all at the same time.

  • cant you rewrite this:

    left outer join (select ORDER_ID, DIRECTORY_ID, ID from t_MTSTM_STOP where ACTIVE = 1 and STOPTYPE_ID = 8583) SHIPSTOPTABLE on SHIPSTOPTABLE.ORDER_ID = ord.ID

    like this

    left join t_MTSTM_STOP SHIPSTOPTABLE ON SHIPSTOPTABLE.id = ord.id AND SHIPSTOPTABLE.Active=1 AND SHIPSTOPTABLE.STOPTYPE_ID = 8583

    This second way is not a subquery, so it is all indexed when you join.  I think you can re-write most of your subqueries this way.  Only the ones with groups in them have to stay.

    Sorry that i'm so tired and not at a bar and its friday night, so i'll leave it to yall to fix my sql if its got syntax errors.  i think its close.

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply