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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||