Questions tagged [query-tuning]
123 questions
1
vote
2 answers
How to increase Simple T-SQL query Performance - taking long hours to complete. Please....!
I have the following simple query with 2 table joins and a WHERE clause.
I already indexed the key joining fields as well as the WHERE clause field.
These 2 tables have about 123 million rows which is pretty huge. It takes about 7/8 hours to…

Syed
- 69
- 4
1
vote
1 answer
Mysql intersection query performance
I am quite new to mysql. I have 2 identical mysql tables which have 50K rows (70 columns) each. Those tables are updated everyday by a datafeed. I need to execute some nested queries like intersections / substractions etc.
One of the queries I try…

J.Corby
- 25
- 5
1
vote
1 answer
Group by too slow on Amazon RDS Postgres
I am running Postgres 9.4.4 on an Amazon RDS db.r3.4xlarge instance
- 16CPUs, 122GB Memory.
I recently came across one of the queries which needed a fairly straight forward aggregation on a large table (~270 million records). The query takes over…
1
vote
1 answer
Improving MySQL Select statement in WordPress theme
I'm using the WordPress theme Engine from Industrialthemes and see that the rendering of the front page uses a lot of queries that uses around 0.4 seconds to run in my MySQL database. Like this one:
SELECT SQL_NO_CACHE SQL_CALC_FOUND_ROWS…

Frank
- 53
- 4
1
vote
1 answer
MySQL Query Optimization for running total query - How can I reduce query exectuion time?
Problem
I have a query that I pasted below. The problem I face is how can I trim the latency to under the current time of about 10 seconds.
set@ csum = 0;
SELECT Date_format(assigneddate, '%b %d %Y') AS assigneddate, (@csum: = @csum +…

Vahe
- 1,699
- 3
- 25
- 76
1
vote
1 answer
Query optimization in SQL Server
SELECT
T2.Entity1Id, T1.Entity1Id
FROM
T1
FULL OUTER JOIN
T2 ON T1.c2 = T2.c2 AND T1.c1 = T2.c1 AND T1.c3 = 1
WHERE
((T1.c1 = 123 ) OR (T2.c1 = 123))
AND (T1.c3 = 1 OR T1.c3 IS NULL)
Above query is taking 12 seconds in…

Sparrow
- 355
- 4
- 19
1
vote
0 answers
Tuning SQL Query which returns REF CURSOR
I am using reference cursor in function to return values. This function is getting called recursively for different input values.
My package Definition is as follows.
create or replace PACKAGE AI_QUERY_EXECUTION_PKG IS
TYPE…

Shriraj
- 133
- 4
- 11
1
vote
2 answers
Neo4j performance tuning for small database
I'm working with a Neo4j 1.9.7 database with a little small graph:
Nodes 19.806
Properties 230.175
Relationship 83.853
Relationship types 3
I've imported this data via Sail to use the SPARQL Plugin to perform some…

Ancelot182
- 149
- 1
- 7
1
vote
1 answer
Oracle SQL Query Running Slow
I've a oracle SQL Query below used for Search Functionality and it's wrapped in Stored Procedure.
It runs very slow.
OPEN p_cursor FOR
SELECT
TableA.*, TB_S.someColumn, TB_S.SomeColumn ..
FROM
…

Nil Pun
- 17,035
- 39
- 172
- 294
1
vote
1 answer
SQL Server : same query running multiple times with different execution time
I have a very simple query
SELECT count(*) FROM MyTable
There are 508,000 rows in it. When I run the above query for the very first time it takes approximately 53 seconds to return the result. If I rerun the query again, it takes milliseconds to…

Imran Zahid
- 25
- 1
- 7
1
vote
1 answer
running same query on console taking time twice?
I am running a query -
SELECT COUNT(DISTINCT c.msisdn)
FROM cdr c
WHERE c.evedate>='2013-10-01';
On executing first time, taking 1 minute. But executing the same query within second taking 3 minutes.
Why is it happening?
I have found the same…

Aamir
- 738
- 2
- 17
- 41
1
vote
2 answers
Two scripts - when and how to apply functions to the WHERE clause
WH.dbo.vw_FactTable is a huge table 100mill rows with good indexing on DateKey
This runs almost instantaneously:
1.
SELECT COUNT(*)
FROM WH.dbo.vw_FactTable bi
WHERE DateKey >= 20130101 AND
DateKey <= 20130110
This takes two…

whytheq
- 34,466
- 65
- 172
- 267
1
vote
1 answer
Drawbacks of using manually created temporary tables in MySQL
I have many queries that use manually created temporary tables in MySQL.
I want to understand if there are any drawbacks associated with this.
I ask this because I use temporary tables for queries that fetch data shown on the home screen of a web…

Ravi
- 2,472
- 3
- 20
- 26
1
vote
2 answers
Oracle Query/SQL tuning
I have a table with total 198695 records and 96579 records with project_id =555.
I have list interval partitioned the table by project_id.
If i run the below query(without distinct),it takes 0.75 secs to run.
SELECT …

user2342436
- 492
- 3
- 17
1
vote
1 answer
SQL Server Performance tuning of While loop with correlated sub query
In my project I came across a challenge with below T-SQL code.
step1 populates the UserModules table with parent modules and its subscribed users
step2 checks for child modules associated to modules in step1 in Modules_Hierarchy table and inserts…

user2000502
- 13
- 3