Questions tagged [database-tuning]

Performance tuning done by adjusting database parameters or physical layout of the database.

Database Tuning is quite a broad term and can involve a variety of optimisations that can be made to server configuration, physical storage layout, indexing and structure of the database, or recovery strategies.

Many performance issues can be resolved by modifying queries to run with an efficient execution plan or adding indexes to speed up slow queries. Sometimes performance issues can be caused by poor disk layout, or insufficient memory or contention over a finite pool of resources such as locks.

Index tuning involves examining poorly performing queries and adding indexes to the database that can be used by the optimiser.

Storage can be tuned in various ways to optimise performance. For example, it is often desirable to separate indexes onto their own volume. Another example of application specific tuning might be a data warehouse system tuned for fast table scans - a large stripe size on an array will typically improve sequential I/O performance.

System tuning can involve setting memory allocation strategies - a highly concurrent system may be set up to allocate a small amount of memory per session so that a large number of concurrent transactions do not consume excessive memory. A system characterised by queries across large data sets may be tuned to allocate a large amount of memory to sort operations. Some systems take a more automated approach to memory allocation.

Other factors such as logging and recovery strategies, processor and I/O affinity on NUMA systems, isolation level used on frequent transactions or the size of disk buffer caches relative to the working set of the application can also have a significant effect on performance. Tuning work may involve examining a variety of such factors to identify and resolve performance bottlenecks

136 questions
43
votes
7 answers

Is it better to store images in a BLOB or just the URL?

Possible Duplicate: Files - in the database or not? I was wondering if there's any good reason to still use blob fields in a database. A couple of years ago I worked with a DB with a bunch of images in it, the DB was very slow and I couldn't see…
eiefai
  • 1,874
  • 2
  • 21
  • 18
33
votes
3 answers

MySQL creates temporary tables on disk. How do I stop it?

We are running a site (Moodle) that the users currently find slow. I think I have tracked down the problem to MySQL creating temporary tables on disk. I watch the variable created_tmp_disk_tables in Mysql Workbench server administration and the…
user30431
  • 463
  • 1
  • 5
  • 11
32
votes
2 answers

Where can I find database tuning exercises for learning?

As a developer, often DBAs take responsibility for resolving performance issues at the database level so we don't get that much experience diagnosing, tuning, refactoring queries etc. I'm looking for a database with a bunch of tables, data,…
flesh
  • 421
  • 4
  • 3
30
votes
5 answers

How can I tell WHY an insert on a certain table is slow?

I know that an INSERT on a SQL table can be slow for any number of reasons: Existence of INSERT TRIGGERs on the table Lots of enforced constraints that have to be checked (usually foreign keys) Page splits in the clustered index when a row is…
BradC
  • 10,073
  • 9
  • 51
  • 89
20
votes
2 answers

Designing a user authenication (Roles & Rights) module

I am trying to model a User Authentication module for a MS SQL Server database that will be the back end to a Delphi UI Application. Basically, I want to have user accounts where the user belongs to only one group. A group can have "n" number of…
15
votes
3 answers

MySQL table_cache and Opened_tables

I have seen people use the comparison of Open_tables and Opened_tables to assess whether the table_cache is too small in MySQL. However, I believe that Opened_tables is cumulative across uptime, so this is not a valid comparison. The only caveat…
Sam Brightman
  • 281
  • 1
  • 2
  • 4
13
votes
1 answer

Can I safely kill OPTIMIZE TABLE on an InnoDB table?

MySQL's documentation for kill warns: Warning Killing a REPAIR TABLE or OPTIMIZE TABLE operation on a MyISAM table results in a table that is corrupted and unusable. Any reads or writes to such a table fail until you optimize or repair it again…
KCD
  • 279
  • 1
  • 4
  • 14
13
votes
2 answers

SELECT TOP 1 harms query performance; is there a dba-accessible way to overcome this?

In a production application (C# talking to SQL Server 2014 Standard) there's a query that looks like this, below. Most of the time it runs in milliseconds. But occasionally (for certain values of @Id), it goes nuts and takes a minute or so. This is…
12
votes
1 answer

Optimize PostgreSQL for a lot of INSERTS and bytea updates

What we have (software): PostrgeSQL 9.3 with base configuration (no changes in postgresql.conf) Windows 7 64 bit Hardware: Intel Core i7-3770 3.9 Ghz 32 Gb RAM WDC WD10EZRX-00L4HBAta Drive (1000Gb, SATA III) So, we have to load into DB aprox.…
12
votes
2 answers

SQL Server: Has anyone used the large-page allocations tuning option?

Has anyone used the tuning option of using TF834 large page allocations. I was just reading an MS article on it and was wondering if anybody had used it and seen performance gains. Are there any things to watch out for, tips, pitfalls? The server is…
StanleyJohns
  • 5,982
  • 2
  • 25
  • 44
12
votes
3 answers

Executing same request from C# VS SSMS give different execution time

I have a request like this one SELECT [EstimateId], [CreationUserId], [EstimateStatusValueId], [LanguageId], [LocationId], [EstimatorUserId], [FilterUnitSystemTypeId], [EstimateNumber], [RevisionNumber], [CreationDate],…
Nico
  • 1,062
  • 1
  • 9
  • 18
10
votes
2 answers

Could not continue scan with NOLOCK due to data movement

We run SQL Server 2000 and we get a few of these errors every night. Could not continue scan with NOLOCK due to data movement The query that throws this error is a large complex query that joins over a dozen tables. Our underlying data can be…
Ciaran Archer
  • 395
  • 2
  • 3
  • 10
9
votes
1 answer

How can a fill factor of 0 or 100 be the same?

As of my understanding, Fill factor of 80 implies that 20 percentage of each leaf-level page will be empty to enable future growth. I can't correlate how fill factor of 0 and 100 can be the same! Am I missing something?
Subha
  • 97
  • 1
  • 8
8
votes
1 answer

Why does SQL Server run a subquery for each row of the table it's qualifying?

This query runs in ~21 seconds (execution plan): select a.month , count(*) from SubqueryTest a where a.year = (select max(b.year) from SubqueryTest b) group by a.month When the subquery is replaced with a variable, it runs in <1 second…
8
votes
1 answer

Optimizing PostgreSQL for transient data

I have several tables with 100-300 columns of integer types each, that hold highly volatile data. The datasets are keyed by one or two primary keys, and when refresh occurs, the whole dataset is deleted and new data is inserted in one transaction.…
Alex Tokarev
  • 183
  • 5
1
2 3
9 10