SELECT different rows on multiple threads

  • I have an application which will be reading from a single table, in order to speed up the processing of each row it will run multiple threads, as soon as each thread finishes it will read again from the same table.

    My first approach is to select the rows assigned to an index of each thread by using modulus on the where clause

    SET @maxThreads = 10

    SELECT TOP 1 * FROM Table1 WHERE id % @maxThreads IN (0, @maxThreads)

    Any idea how else I can accomplish this?


    slow down when you need to hurry, stop when you need to move on,
    look back when you need to forget, or you might slip and leave sanity

  • Why are you looking for an alternative approach - does yours not work?  What processing do you do on each row once you've selected it?

    John

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

Viewing 5 posts - 1 through 4 (of 4 total)

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