performance-tuning

Two left joins and one query to MySQL performance problem

Hello, I'm designing a project for quizzes and quizz results. So I have two tables: quizz_result and quizz. quizz has primary key on ID and quizz_result has foreign key QUIZZ_ID to quizz identity. Query below is designed to take public quizzes ordered by date with asociated informations: if current user (683735) took this quizz and has...

Why is this MySQL UPDATE taking forever?

I'm trying to figure out why one of our migration scripts is taking forever we are trying to do an update that joins from another table to get a relevant piece of data. Each table (A, B) has about 100,000 rows. # now populate the ACHIEVEMENT_INSTANCE.OBJECTIVE_INSTANCE_ID update A a, B b set a.INSTANCE_ID = b.INSTANCE_ID where a.ID = b...

Indexing Performance BigInt vs VarChar

This is a FACT Table in a Data Warehouse It has a composite index as follows ALTER TABLE [dbo].[Fact_Data] ADD CONSTRAINT [PK_Fact_Data] PRIMARY KEY CLUSTERED ( [Column1_VarChar_10] ASC, [Column2_VarChar_10] ASC, [Column3_Int] ASC, [Column4_Int] ASC, [Column5_VarChar_10] ASC, [Column6_VarChar_10] ASC, [C...

MySQL Slow Query Analysis and Indexing

Recently, we've noticed a particular query popping up in our slow query logs taking quite some time. I've analyzed it to the best of my ability, but can't figure out for the life of me why it's taking so long, and why the indexes we've set up aren't being used. Here's a simplified (i.e., readable) version of the query for the purpose ...

Mysql index configuration

Hello, I have a table with 450000 row full of news. The table schema is like this: CREATE TABLE IF NOT EXISTS `news` ( `id` int(11) NOT NULL auto_increment, `cat_id` int(11) NOT NULL, `title` tinytext NOT NULL, `content` text NOT NULL, `date` int(11) NOT NULL, `readcount` int(11) NOT NULL default '0', PRIMARY KEY (`id`), ...

Ruby Benchmark module: meanings of "user", "system", and "real"?

Experimenting with Ruby's Benchmark module... >> Benchmark.bm(7) { |b| b.report('Report:') { s = '' ; 10000.times { s += 'a' } } } user system total real Report: 0.150000 0.010000 0.160000 ( 0.156361) What are the meanings of "user", "system", and "real"? ...

Will client side performance improve if images/scripts/styles on different subdomains?

Hi, I have a domain specifically for static content, so cookies don't travel along with requests to images/scripts/css. Now, I think I've read somewhere that most browsers only open one download thread for each domain/subdomain, so different static content can't be downloaded in parallel if on the same domain. Will it make difference fo...

SQL Server Performance Tuning Recommendations or Exporting Indexes

We were doing load testing the other day and during it, one of our developers used the Performance Tuning Advisor and applied all the recommendations. Our site could then handle a lot more load and we were happy. However he did not save the recommendations and the load test was not done on our production server. I can't figure out how ...

MySQL tuning on a regular basis without restart

I have a 5GB database, all tables are MyISAM. It runs into heavy load time from 01:30AM to 8:30AM (100+ selects, 150+ updates, 200+ cache hits per second) to do data analysis, during other time, load is moderate (10 selects, 5 inserts per second). Problem is after a few days, data analysis during heavy load time appears to be slow down ...

Which of these pieces of code is faster in Java?

a) for(int i = 100000; i > 0; i--) {} b) for(int i = 1; i < 100001; i++) {} The answer is there on this website (question 3). I just can't figure out why? ...

IronRuby performance issue while using Variables

Here is code of very simple expression evaluator using IronRuby public class BasicRubyExpressionEvaluator { ScriptEngine engine; ScriptScope scope; public Exception LastException { get; set; } private static readonly Dictionary<string, ScriptSource> parserCache = new Dictionary<string, ScriptSource>(); public BasicRubyExpressio...

When should one avoid using NHibernate's lazy-loading feature?

Most of what I hear about NHibernate's lazy-loading, is that it's better to use it, than not to use it. It seems like it just makes sense to minimize database access, in an effort to reduce bottlenecks. But few things come without trade-offs, certainly it slightly limits design by forcing you to have virtual properties. But I've also ...

How to get slowest queries on SQL 2005, without requiring compability change?

I was reading this fabulous list of sql dba scripts at http://www.sqldbtools.com/Scripts.aspx, not affiliated with them. And I want to run this query... select top 10 qs.execution_count, st.dbid, DB_NAME(st.dbid) as DbName, st.text from sys.dm_exec_query_stats as qs cross apply sys.dm_exec_sql_text(sql_handle) st order b...

Beginner RegEx Replace Performance Question

Hi All, I have this simple regex replace based routine, is there anyway to improve its performance (and maybe also its elegance?) public static string stripshrapnel(string str) { string newstr = str.Trim(); newstr = Regex.Replace(newstr, @"-", ""); newstr = Regex.Replace(newstr, @"'", ""); newstr = Regex...

Tuning a WCF File Server

I'm tuning a server and need some guidance. This server provides the following features: an ASPX page with a DB call that is downloaded approximately every 3 minutes by several thousand machines a simple ASP.NET admin web site used by a tiny number of people but that must be highly available a WCF service that provides file synchroniz...

Can't use a data obj with timeit.Time module in python

I'm trying to measure how long it takes read then encrypt some data (independently). But I can't seem to access the a pre-created data obj within timeit (as it runs in its own virtual environment) This works fine (timing file read operation): t = timeit.Timer(""" openFile = open('mytestfile.bmp', "rb") fileData = openFile.readlines() ...

Reducing memory of similar objects

I'm looking at reducing the memory consumption of a table like collection object. Given a class structure like Class Cell { public property int Data; public property string Format; } Class Table { public property Dictionary<Position, Cell> Cells; } When there are a large number of cells the Data property of the Cell clas...

What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the reports. Where do I go to find ways to improve my app? Edit: For example. If I run the wizard, change my application to something I think is b...

LINQ / SQL Performace problem with a very long list

In our database we have a table with more then 100000 entries but most of the time we only need a part of it. We do this with a very simple query. items.AddRange(from i in this where i.ResultID == resultID && i.AgentID == parentAgentID orderby i.ChangeDate descending select i); After this Query we get a List with up to 500...

Slow Execution of an ASP.NET Web Page

I have a web page which brings 13K+ records in 20 seconds. There is a menu on the page, clicking on which navigates me to another page which is very lightweight. Displaying the data (13K+) took only 20 seconds whereas navigating from that page took much longer, more than 2 mins. Can you tell me why is the latter taking so much of time. I...