optimization

Optimize this SQL Query

This SQL query disgusts me. I didn't write it, but it's a massive cause of issues on our servers. I'm willing to split it up into multiple queries and do some of the processing via PHP (like, the RAND()). $sql = "SELECT a.code, a.ad_id, a.position, a.type, a.image, a.url, a.height, a.width FROM " . AD_TABLE ." a, " . USER_GROUP_TABLE ...

Optimize SELECT DISTINCT CONCAT query in MySQL

Hello! I'm running this query: SELECT DISTINCT CONCAT(ALFA_CLAVE, FECHA_NACI) FROM listado GROUP BY ALFA_CLAVE HAVING count(CONCAT(ALFA_CLAVE, FECHA_NACI)) > 1 Is there any way to optimize it? Queries are taking 2-3 hours on a table with 850,000 rows. Adding an index to ALFA_CLAVE and FECHA_NACI would work? Thanks in advanced ...

SSE2 option in Visual C++ (x64)

I've added x64 configuration to my C++ project to compile 64-bit version of my app. Everything looks fine, but compiler gives the following warning: `cl : Command line warning D9002 : ignoring unknown option '/arch:SSE2'` Is there SSE2 optimization really not available for 64-bit projects? ...

For innodb table in MySQL, which is faster: varchar(255) or tinytext?

I am optimizing some innodb tables in MySQL, so I ran procedure analsye() to see what the recommendations were. The results recommended tinytext instead of varchar(255) for all the fields that were previously set up as varchar(255) Is there a performance gain to be had by using tinytext? I am only concerned about speed here, not size. ...

Does "if ([bool] == true)" require one more step than "if ([bool])"?

This is a purely pedantic question, to sate my own curiosity. I tend to go with the latter option in the question (so: if (boolCheck) { ... }), while a coworker always writes the former (if (boolCheck == true) { ... }). I always kind of teased him about it, and he always explained it as an old habit from when he was first starting progr...

Optimizing a Cocoa/Objective-C search

I'm performing a search of a large plist file which contains dictionaries, tens of thousands of them, each with 2 key/string pairs. My search algorithms goes through the dictionaries, and when it finds a text match in either of the strings in the dictionary, the contents of the dictionary are inserted. Here is how it works: NSDictionary...

Dynamically allocated arrays or std::vector

Hey, I'm trying to optimize my C++ code. I've searched the internet on using dynamically allocated C++ arrays vs using std::vector and have generally seen a recommendation in favor of std::vector and that the difference in performance between the two is negligible. For instance here - http://stackoverflow.com/questions/381621/using-array...

Further information about last_query_cost in MySQL?

Hi, When doing query optimization, the SHOW STATUS query returns values that are easy to understand with some practice and explanation. But last_query_cost is obscure and poorly documented. The only thing explained is that it must be read as an anti-macho value: the smaller the better. But do we have further information about this hi...

GCC giving different numerical results with -O0 and -O2

I'm using 4.1.2. Does anyone have any ideas of the best places in my code to look? Experience with common causes? There are some ugly pointer casts (ie, d = (double) (* (float *) p), where p is pointer-to-int) that I'm working on eliminating, but no luck yet. For what it's worth, -O0 is giving the correct answer. Thanks for any help. ...

Bad performance on deleting referenced database rows with Linq To SQL

Hey, I've got an performance issue in my application using a MSSQL DB. I have a Database Architecture with the following tables: Job (Primary Key: Job ID) Jobitem(Primary Key: Jobitem ID, Foreign Key: Job ID) Job2Property (Foreign Key: Job ID <-> Property ID) Jobitem2Property(Foreign Key: Jobitem ID <-> Property ID) Property (Primary ...

User Details like in stackoverflow at the bottom of each question and answer

Hi, I was wondering how stackoverflow.com implemented user info below each post , based on data dump of stackoweflow in Posts table are : OwnerDisplayName and OwnerUserId records, but what about reputation score s and badges ? are there made joins to user table on each post ? Is there other way to get such info? Maybe i...

How to recommend the next achievement

Short version: I have a similar setup to StackOverflow. Users get Achievements. I have many more achievements than SO, lets say on the order of 10k, and each user has in the 100s of achievements. Now, how would you recommend (to recommend) the next achievement for a user to try for? Long version: The objects are modeled like this in ...

Optimizing address routes - web-based

We are trying to better understand how to set up MapPoint (or another map application) to optimize delivery routes for us. We have the ability to push lists of delivery addresses from our .NET system but need some simple options for the drivers to select a starting point address and to be able to reorder the addresses visually if necessa...

how to optimize image in java for performance

Hello all im transeffing image throw tcp/ip and i like to optimize it and still good quality as much as possible what kind of methods or algorithms i can use ? p.s now if i think about it maybe i should ask what is the best and the fast way to send image via tcp/ip ...

Finding a timeline using a range of values - entity modeling

Let's say I have two entities: Event and Activity An Event is something that happens at (seemingly) random times, like Sunrise, Sunset, Storm, Fog, etc. I have a table for this: create table Event ( eventKey int, eventDesc varchar(100), started datetime ) EventKey | EventDesc | Started 1 "Sunset" 2009-07-03 6:51pm ...

CSS Reduction Tool

Hi all, I was wondering whether anyone knows of any tools available that perform the task of analyzing one or more CSS files, determining the similarity between the various rules within the files and presenting the user with options for the merging and reduction of rulesets. I ask this because a project I am working on has reached the p...

What tools etc can be used to optimize a PHP web application running on an Windows 2003 IIS 6 server

What would you guys use to monitor an IIS server performance, detect and respond to errors etc, find bottlenecks, visualize CPU utilization under load, monitor PHP MySQL performance etc. cheers ...

C++ Dependencies manager

We have here a pretty big application that is taking a lot of time to compile and I am looking for a way to reduce this compile time. I thought a good way to do this would be to reduce the dependency between the include files. Do you know any good dependency/Includes manager that would be pretty cheap? Something that would draw me a good...

Under what conditions does ROWNUM=1 significantly increase performance in an "exists" syle query

I read some of the discussion in this question and thought to myself that in my PL/SQL code I have "exists" style queries all over the place that don't use the ROWNUM=1 optimisation. The questions I have are: Does the introduction of ROWNUM=1 significantly increase performance? If so, under what conditions would performance be particu...

Dot product - SSE2 vs BLAS

What's my best bet for computing the dot product of a vector x with a large number of vectors y_i, where x and y_i are of length 10k or so. Shove the y's in a matrix and use an optimized s/dgemv routine? Or maybe try handcoding an SSE2 solution (I don't have SSE3, according to cpuinfo). I'm just looking for general guidance her...