Questions tagged [query-tuning]
123 questions
0
votes
3 answers
How to tune the following query?
This query gives me the desired result but i can't run this query every time.The 2 loops is costing me.So i need to implement something like view.But the logic has temp tables involved which isn't allowed in views as well.so, is there any other way…

Subek Shakya
- 595
- 4
- 10
- 28
0
votes
1 answer
PostgreSQL 9.4 query tuning
I have a query that is running too slowly.
select c.vm_name,
round(sum(bytes_sent)*1.8/power(10,9)) gb_sent,
round(sum(bytes_received)*1.8/power(10,9)) gb_received
from groups b,
vms c,
vm_ip_address_histories d,
…

EmbodyHumility
- 3
- 2
0
votes
0 answers
Plan select query with data load is performing slow in oracle
Database - Oracle 11g
We have a table TB_ETD_NON_MKTS_TRANS_OP with 30 million records
We have indexes on REPORTING_PARTY, REPORTING_TIMESTAMP.
We are executing query as
SELECT *
FROM
(select
COUNT(*) OVER () CNT,
ROW_NUMBER() OVER (ORDER BY…

Rahul Agrawal
- 8,913
- 18
- 47
- 59
0
votes
1 answer
SQL Server Query having multiple left outer joins hangs
I have two tables say for ex: table1 and table2 as below
Table1(id, desc )
Table2(id, col1, col2.. col10.....)
col1 to col10 in table 2 could be linked with id field in table1.
I write a query which has 10 instances of table1 (each one to link…

Muthukumar Palaniappan
- 1,622
- 5
- 25
- 49
0
votes
1 answer
Need to optimize slow query in DB2 using group by on timestamp
Requirement: Number of billing records created Year and provincewise.
Database: DB2 9.5
Below is the query which is used to fetch the details, Its taking huge time, more then 1 hour and getting timedout.
Number of records are as follows in each…

Vinayak Dornala
- 1,609
- 1
- 21
- 27
0
votes
1 answer
How to get latest inserted value on not grouped column?
How get MY_LATEST_INSERTED_NUMBER_BASING_ON_MY_DATE_COLUMN_FOR_ID_CONTEXT in more efficient and elegant way from below query ?
SELECT MAX(MY_DATE_COLUMN),
ID,
listagg(SOME_COLUMN, '') within GROUP (ORDER BY MY_DATE_COLUMN),
SUBSTR(
…

rtbf
- 1,509
- 1
- 16
- 35
0
votes
0 answers
How to properly index sql server table to increase query performance
i need to add correct indexes to a temp table to speed up a query. according to msdn i check the menu "Include Actual Execution Plan" and run the query in SSMC, after the execution i can see the query plan but there's no indication about the indexes…

FDB
- 971
- 16
- 32
0
votes
2 answers
Store common queries on disk with Mysql and windows
I have a Huge person database and do common search with name on it.
SELECT * FROM tbl_person WHERE full_name LIKE 'Sparow%Jack%';
SELECT * FROM tbl_person WHERE full_name LIKE 'Sparow%';
I rarely insert new data in this table.
I want to store…

Mathieu Brousseau
- 134
- 2
- 2
- 10
0
votes
1 answer
How to select id, first_not_null(value1), first_not_null(value2).. on Postgresql
I have a table like this:
+--+---------+---------+
|id|str_value|int_value|
+--+---------+---------+
| 1| 'abc' | |
| 1| | 1 |
| 2| 'abcd' | |
| 2| | 2 |
+--+---------+---------+
I need to get…

Alex
- 1,186
- 10
- 12
0
votes
2 answers
cursor_sharing parameter in Oracle
I would like to know the tradeoff in setting cursor_sharing parameter in Oracle as "FORCE" .
As this would try to soft-parse any SQL statement, and certainly the performance must be improved.
But the default value is "EXACT", so I would like to know…

Remis Haroon
- 31
- 2
-1
votes
2 answers
An effective way of calculating total sum of all transaction amounts for an account
I have a system that lets users entering financial transactions including dollar amounts. Once transaction is added\updated or removed from the system the account total has to be re-calculated and displayed to the user instantly. Users have access…

Art
- 139
- 7
-1
votes
3 answers
Increase SQL Query Performance
Sql:
select distinct DateAdd(Day, DateDiff(Day, 0, m.Receive_date), 0) as Date,
(select count(*) from Raw_Mats A where DateAdd(Day, DateDiff(Day, 0, A.Receive_date), 0)=DateAdd(Day, DateDiff(Day, 0, m.Receive_date), 0)) as Total,
(select count(*)…

ARB
- 285
- 1
- 6
- 17
-1
votes
1 answer
DB2: Improve performance of SQL query with scalar function
I have a large query which I am trying top optimize. One of the condition which I would like to change is as shown below. i.e I am trying to remove scalar functions.
Current:
DATE( ACTIVITY.CREATED) ='2009-02-18'
to
ACTIVITY.CREATED BETWEEN …

Vinayak Dornala
- 1,609
- 1
- 21
- 27
-2
votes
2 answers
Performance issue using while loop in insert statement
I am using a try catch block to catch the data with constrain errors.
eg. if null inserted in not null column or if duplicated record inserted or the type mismatch occurs, all the source records with error should go to error log table and rest of…

Dilip Chauhan
- 1
- 1
-2
votes
1 answer
SQL Performance Issue : Timing Out
Following SQL query is taking more than 5:19 minutes to execute in Production. This SQL is dynamically generated from server side C# code and takes long time to execute for few clients. Due to long time in production Web service is timing out. Can…

Partha Mitra
- 55
- 1
- 1
- 10