A different approach: You seem not to be concerned about memory usage.. so.. . I might try to: - create a heap table (in memory table in MySql terms)
- query just the red range into that table
- run a query against the heap table to delete records with green values outside the range of what you want
- then do the same type of query to delete the records which are outside the range of blue values you want
The initial heap table will probably be huge, but I am guessing you have plenty of memory. This is of course a brute force method, and you may have to limit your initial query a bit more. However, once the initial query is done: - the subsequent delete queries will be very fast
- you will recover unused memory
Once you are down to the initially required set, further queries will be very, very fast. Not elegant, but I have done this with large data sets when I don't have the time to mess with re-designing the schema, or coding fancy algorithms (which I am not good at anyway), and it worked great!..
Just a thought....
- ...the majority is always wrong, and always the last to know about it...
- The Spice must flow...
- ..by my will, and by will alone.. I set my mind in motion
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|