Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are thinking in terms of "loops". On a relational database you should think in terms of "sets". Working with loops in a stored procedure is often done with cursors. It is slow (like a 50 - 100 times slower than working set oriented) and the locking mechanism associated with cursors may lock out other processes. That's why you should always avoid using them. </p> <p>The fastest solution is working with a stored procedure. There can be no discussion about that. The biggest difference is that it cuts out all network traffic. SP's run directly on the database, there is no network traffic slow-down. Debugging them can be a pain though, but I have heard Visual Studio 2010 offers some improvements on that.</p> <p>The next thing you should think about is HOW to implement the stored procedure: You can go the slow locking way of loops and cursors or the fast set oriented way. </p> <p>Based on your description, you might gain <em>a lot</em> in performance by keeping some data in two tables: one your regular table with all data, the other a "window-table" that only holds the data that you need to populate those 5 min, 10 min and 15 min, ... bars. If you can create a 15 min bar with the data of the three last 5 min bars, then store those 3 last 5 min bars in the window-table, when a 4th 5 min bars arrives, kick out the oldest 5 min bar and insert the new 5 min bar. When you can create the new 30 minute bar based on the last 2 15 min bars, then store those 2 15 min bars, .... Try to keep this window-tabel as small as possible, so it can stay in memory all the time.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload