Best Practice: Does it matter (for performance reasons) where a tagged field search occurs in a query?

It is good practice to any filtering at the start of a query as this reduces the number of events that have to be processed in later stages of the query. This includes tagged and standard field filters. The query optimized is intelligent enough to identify the tagged fields and ensure that they are executed first. This ensure that this query:

HOST=name1 | PROGRAM=test | #FIELD=testdata


#FIELD=testdata | HOST=name1 | PROGRAM=test

Are optimized identically.

If your query uses the case or match(), it is best to place these after any tag or field filtering.