Questions tagged [sql-tuning]

SQL tuning commonly involves finding more efficient ways to process the same workload. It is possible to change the execution plan of the statement without altering the functionality to reduce the resource consumption.

328 questions
4
votes
4 answers

Please help me optimize this MySQL SELECT statement

I have a query that takes roughly four minutes to run on a high powered SSD server with no other notable processes running. I'd like to make it faster if possible. The database stores a match history for a popular video game called Dota 2. In this…
DaiBu
  • 529
  • 3
  • 17
4
votes
4 answers

Oracle 11g - most efficient way of inserting multiple rows

I have an application which is running slowly over a WAN - we think the cause is multiple inserts into a table. I'm currently looking into more efficient ways to insert multiple rows at the same time. I found this method: INSERT ALL INTO…
user1578653
  • 4,888
  • 16
  • 46
  • 74
3
votes
2 answers

Performance issue with inline view in Oracle

I have a query that looks like below and the tables A,T,S have around 1 million rows whereas P have more than 100 million rows. I've newly introduced the inline view "temp" into this query and it caused a drastic degradation in performance. The data…
Varun
  • 1,014
  • 8
  • 23
3
votes
3 answers

SELECT clause using IN ... very slow?

Could you guys please review the following query to an Oracle DB and point out what's wrong: SELECT t1.name FROM t1, t2 WHERE t1.id = t2.id AND t2.empno IN (1, 2, 3, …, 200) Query statistics: Time taken: 10.53 seconds. Indices: t2.empno is…
Sudhakar
  • 4,823
  • 2
  • 35
  • 42
3
votes
1 answer

Special case of Equi Join

I came across this particular script which uses a special form of equi join. SELECT * FROM per_assignments a, per_assigment_types b WHERE a.assignment_status_type_id + 0 = b.assignment_status_type_id Why is the zero added in the equi join? I…
NirmalGeo
  • 773
  • 4
  • 12
3
votes
2 answers

Is there a hint to generate execution plan ignoring the existing one from shared pool?

Is there a hint to generate execution plan ignoring the existing one from the shared pool?
general46
  • 800
  • 6
  • 16
3
votes
1 answer

Use COPY FROM command in PostgreSQL to insert in multiple tables

I'm trying to use the performance of COPY FROM command in PostgreSQL to get all data of 1 table of a CSV file (CSV -> table1) and I need to insert other data, but, in a new table. I will need of a primary key of first table to put as a foreign key…
3
votes
0 answers

Sudden drop in SQL Azure query performance after moving web app to Azure

What could explain this big drop in performance in an Azure SQL DB after moving the app from an hosted VPS to an Azure App service? Here's a typical chart from Query Store's High Variation chart over the past two weeks. The red arrow indicates when…
3
votes
1 answer

Creating a clustered index on a foreign key is frequently joined to another table

I was recently doing some performance optimization/query tuning on a table and had a question about using a foreign key as a clustered index. The table structure/relationships is as follows: I am working in an invoicing application and there are…
Hunter Nelson
  • 1,707
  • 3
  • 20
  • 37
3
votes
2 answers

Joining sums of different periods from the same data set

I often face the situation where I need to compare aggregated data of different periods from the same source. I usually deal with it this way: SELECT COALESCE(SalesThisYear.StoreId, SalesLastYear.StoreId) StoreId , SalesThisYear.Sum_Revenue…
Diego Queiroz
  • 3,198
  • 1
  • 24
  • 36
3
votes
1 answer

Using Oracle build-in UPPER function in WHERE lead to bad performance of SELECT statement?

Our Oracle database application contains a Table called PERSON This Table contains a column called PERSON_NAME Also we have an INDEX on this column to speed up SELECT using this column So when we use following SQL statement performance is fine …
Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
3
votes
2 answers

Hibernate performance tuning tips

I'm developing a small application, which consists of a single table. I am using technologies are: NetBeans 8.1 Java 8 Hibernate 4.3.x Informix Primefaces 5 I had to investigate a time to connect with Informix Hibernate, but I got it, and the…
3
votes
1 answer

Teradata SQL : insert random data for testing into Table

I am trying to create random data and insert it into a table. Right now just thinking what'd be the efficient approaches to get this done. e.g. Create volatile table mytb , no fallback, no journal ( C1 integer not null C2 Varchar (50) Not null ,…
user1874594
  • 2,277
  • 1
  • 25
  • 49
3
votes
2 answers

Is using OR clause in MySQL SELECT statement a generally bad idea?

I was having a problem with the query the other day. It took about 10 seconds for a large dataset. The query looked something like this: SELECT a.* from Document as a LEFT JOIN Waybill as b on a.waybill = b.id WHERE a.enterpriseGuid =…
SPIRiT_1984
  • 2,717
  • 3
  • 29
  • 46
3
votes
2 answers

Oracle: hugely improve query performance

I have this next query for which I'm trying to improve performance: select atx.journal_id ,ab.c_date from acct_batch ab join acct_tx atx on ab.acct_id = atx.acct_id and ab.batch_id = atx.batch_id join journal j on j.journal_id =…
Radu Gheorghiu
  • 20,049
  • 16
  • 72
  • 107
1
2
3
21 22