I believe that for the index to be used the FOR clause has to exactly match the index key expression. I think, but I'm not sure, it has to be on the left side of the expression. So, if COPY TO actually does get all the records you want, I would try
SET ORDER TO myTag
COPY TO myFile FOR v_Inventory BINTOC(INV_PK) + BINTOC(INV_CPK) = myValue
If that doesn't work, you'll have to wait 10 seconds for Sergi to give the correct answer!!
>I've got a remove view that may contain uncommitted information. I need to be able to pull a subset from this view where I will get data that is both committed and data that is not committed... I have found that SELECT won't work because it doesn't pull uncommitted changes. I've been told that I can try to use the COPY TO command to get the information that I want but it seems much slower...
>
>I am using the index:
>
>INDEX ON v_Inventory BINTOC(INV_PK) + BINTOC(INV_CPK) TAG INVMAIN
>
>The original SELECT statement, which had a WHERE clause, executed very quickly once I put this index on the view..but since I can no longer use SELECT(because of the uncommitted changes problem) I am trying to find a way to optimize the COPY TO command. It doesn't seem to be using the index with its FOR clause as its performance is *MUCH* slower than the SELECT even though I am using the exact same COPY TO FOR clause that I was using in the SELECT WHERE clause(and thus should be using the index)..
>
>Does anyone know of a way to speed up the COPY TO(i.e. make it use the index, if it is not doing so) or a way to get around the uncommitted changes problem that drove me here in the first place?
>
>Thanks alot - Jon