0

I have a clustered application with a in-memory cache in it. During the runtime i load some data to cache from database. But it takes some time.

Since my cache is replicated i want to trigger the load process from all nodes. Currently only master node is runs the sql.

Let's say i have a simple table as;

column1 column2


field1 field1 . . .

If i have 1000000 rows and 2 nodes, i want to load first 500000 from first node and another 500000 from second node. If node size get's more the number of rows is divided to node count.

But i cannot figure out how to limit and partition the data by using ansi sql standart. I have tried with rownum but the syntax is different for rownum for providers.

tolga_kavukcu
  • 59
  • 1
  • 1
  • 10
  • Such operations are dependent on the database you are using, so follow the instructions for that database. – Gordon Linoff Jul 12 '16 at 11:12
  • Actually the target database can be change during lifecycle. I would like to make it generic. But thanks for the tip ! – tolga_kavukcu Jul 12 '16 at 11:39
  • Sounds like you only need counting and paging. Does ansi SQL not have a way to page data? – usr Jul 12 '16 at 12:09
  • Another thread is discussing that http://stackoverflow.com/questions/463859/there-are-a-method-to-paging-using-ansi-sql-only. It seems like there is no ansi-sql way to do paging. See : http://troels.arvin.dk/db/rdbms/#select-limit. – tolga_kavukcu Jul 12 '16 at 12:28
  • 1
    @togitoon . . . The ANSI standard syntax is `OFFSET xx FETCH FIRST yy ROWS ONLY`. This is supported in the most recent versions of all major databases. – Gordon Linoff Jul 13 '16 at 01:10

0 Answers0