How might I optimize this query? The schema:
mysql> show columns from transactionlog;
+---------------+-------------------------------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-------------------------------...
I got this code, I would like to optimize.
I basically can add new columns to "Disp" table later on, and I don't want to come back modify this function.
I cannot use dynamic SQL. Right? Is there anything else that would work in my case?
This is the function:
ALTER FUNCTION [GetDate]
(@hdrnumber INT, @DateColName VARCHAR(50))
RETURNS D...
I need to resample big sets of data (few hundred spectra, each containing few thousand points) using simple linear interpolation.
I have created interpolation method in C# but it seems to be really slow for huge datasets.
How can I improve the performance of this code?
public static List<double> interpolate(IList<double> xItems, ILi...
I need to perform a bitwise equality between two bytes. That means that for instance if I have two bytes: 00011011 and 00011110 the result is 11111010
The only fast way I see is to use the following statement
byte a, b;//set input bytes
byte c = ~(a^b);//output bytes
But I wonder if there is a faster solution for this. After these equ...
This query originally came from a VB6 program accessing MS Access tables which are linked to external databases through ODBC. It takes about 3:30 to run.
Now I've setup a SQL Server 2008 Express box to evaluate how we can migrate to a better database system. So I setup a linked server to the external server (we call it DWPROD) and when ...
(I'm using prototype.js here, but I imagine the same holds true across other libraries as well)
I often find myself writing code like this:
var search_box;
Event.observe(window, 'load', function() {
search_box = $('search_box');
});
function doSomething(msg) {
search_box.innerHTML = msg;
}
Rather then writing it simply like...
I'm building a CGI script that polls a SQLite database and builds a table of statistics. The source database table is described below, as is the chunk of pertinent code. Everything works (functionally), but the CGI itself is very slow as I have multiple nested SELECT COUNT(id) calls. I figure my best shot at optimization is to ask the SO...
I am somewhat familiar with the CUDA visual profiler and the occupancy spreadsheet, although I am probably not leveraging them as well as I could. Profiling & optimizing CUDA code is not like profiling & optimizing code that runs on a CPU. So I am hoping to learn from your experiences about how to get the most out of my code.
There was...
Guys! My problem is optimizaiton of this code for IE 8 (with IE 8 first button is ok, but second doesn't work), Google Chrome (second button is ok, but first doesn't work). I've stack with it, help please. :)
FIRST BUTTON
<div id="spoiler">
<div>
<p style="text-align: center;"><input style="margin: 10px; padding: 0px; width: 150px; fon...
Hi, I am using SQL 2000, and I am running a simple select statement on a table containing about 30 million rows. The select query looks like:
select col1, col2, col3 from Table1 where col4=@col4 and col5=@col5 and col6=@col6
The table has a clustered index in it (i.e. a primary key), but that is not being used as a where criteria. All...
I have a situation in my application. For each x-axis point in my chart, I am plotting 5 y-axis values. To calculate each of these 5 values, I need to make 4 different queries. Ie, for each x-axis point I need to fire 20 sql queries.
Now, I need to plot 40 such points in the my chart. Its resulting in a pathetic performance where it ta...
I've seen this blog:
http://igoro.com/archive/gallery-of-processor-cache-effects/
The "weirdness" in part 7 is what caught my interest.
My first thought was "Thats just C# being weird".
Its not I wrote the following C++ code.
volatile int* p = (volatile int*)_aligned_malloc( sizeof( int ) * 8, 64 );
memset( (void*)p, 0, sizeof( int ...
I'm using Hibernate to work on a new project, and as I work I'm realizing that my original vision for the application may not end up being its destiny. Data that I think is not going to be often requested (and thus lazy-loaded) might end up being needed for 85% of requests. Conversely, data that I'm loading under the assumption it will b...
I need to update my contacts database in SQL Server with changes made in a remote database (also SQL Server, on a different server on the same local network). I can't make any changes to the remote database, which is a commercial product. I'm connected to the remote database using a linked server. Both tables contain around 200K rows.
M...
The table contains about 40,000,000 records having:
CREATE TABLE `event` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`some_other_id_not_fk` int(10) unsigned default NOT NULL,
`event_time` datetime NOT NULL,
`radius` float default NULL,
`how_heavy` smallint(6) default NULL,
PRIMARY KEY (`id`),
KEY `event_some_other...
I just stumbled upon a change that seems to have counterintuitive performance ramifications. Can anyone provide a possible explanation for this behavior?
Original code:
for (int i = 0; i < ct; ++i) {
// do some stuff...
int iFreq = getFreq(i);
double dFreq = iFreq;
if (iFreq != 0) {
// do some stuff with iFre...
is there a better way to write this SQL than using WHERE ... IN (subquery)?
SELECT device.mac, reseller.name, agent.name
FROM device
LEFT JOIN global_user
ON device.global_user_id = global_user.id
LEFT JOIN agent
ON global_user.id = agent.global_user_id
LEFT JOIN reseller
ON global_user.id = reseller.global_user_id...
I'm trying to figure out why a SQL Server stored procedure is executing slowly, so I've put in some crude timers, like this:
Create Procedure DoStuff
As Begin
Declare @Stopwatch datetime
Set @Stopwatch=GetDate()
Print char(13) + 'Task A'
/* Perform Task A */
Print DateDiff(ms, @Stopwatch, GetDate()); Set @Stopwatc...
What are things like survey.map(&:questions).flatten.compact called, so I can find more information about them :). What problems does that &: solve, or what is it doing exactly? Is it used in other languages?
...
Given a table:
id | score | position
=====================
1 | 20 | 2
2 | 10 | 3
3 | 30 | 1
What query can I use to optimally set the position columns using the (not nullable) score column?
(I'm sure I've seen this before but I can't seem to get the correct keywords to find it!)
...