sql - How to improve CROSS JOIN request memory consumption -


For simulation purposes, I need to randomly create rows in the table. I have potential A, Table A and Probability The table of potential events with the column B is.

  Make Table Systemation (generated as a primary key hash generated by Achievement Inkjer Infhenge); Create table B events (EventIIT Integer defaults by default as primary key hash, Event Probleme Decimal (13,10) Null;)  

In order to create events, I use a cross-join request:

  set as a table generated Avent (SELECT SituationId, from EventId (SELECT SituationId, EventId, RAND) () * 100 A Generation Perfection, Event Probability for Citizen's Cross Join Events) where Generation Probability and LT; Event probability);  

I am using the H2 database only in memory mode (i.e., with the following URL: jdbc: h2: mem: db) and the problem is that in the table of conditions approximately 72k rows and Rows in the 600 event table, I'm running out of memory of JVM, I am using Memory mode to be able to run several JVMs in parallel.

I think the use of cross join request is not the best solution, by avoiding making unnecessary records, any idea of ​​improving performance of memory consumption and execution? Thanks, Laurent

I managed to get the required result without using a cross-join request in a subquery (Which was the main memory problem because the results of this subquariation needed to be fully loaded in memory) with the following request:

  create table generating events (selection status id, event id in Serials A Cross Join Events Where (Selection RAN (*) From 100 B state. Sichuasnaidi = A. Sitisnaidi) & lt; Event Probojybiliti);  

subkey:

  (SELECT RAND () * 100 conditions where B.SavingID = A. Situation ID)  
In the WHERE section, in the WHERE section, it is used to apply the rand () value to 'evaluate', otherwise it seems to be cached or used only as RAND () * 100 Must be sufficient for a search result. This subquery is definitely not optimal for performance execution or it may be that if I have some rows in the situation table, but it is currently the best solution.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -