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
0
votes
1 answer

SQL SentryOne Plan Explorer, What is Duration?

I've just started using the SentryOne Plan Explorer to help tune my SQL Server queries, and have a question, I can't seem to find an answer for. What is Duration? I would think it's the total time it took for the query to run. However, every query…
Gemini
  • 109
  • 2
  • 15
0
votes
1 answer

SQL order by with join two tables Optimization

How can I improve the performance by joining two big tables and sort by 1st able unique index? I need only 1st table data with sort by. without order query will performance so fast. Here is the example of queries select a.* from T1 a, T2 b where…
0
votes
2 answers

Update huge table from other (huge) table in SQL Oracle

I have two big tables: Table1 (from_id, to_id, field1, field2, field3) ~ 500K rows Table2 (id_num, field1, field2, field3) ~4M rows I need to update Table2 from Table1 data based on Table2.id_num that should be between Table1.from_id and…
Eithan
  • 133
  • 6
0
votes
0 answers

Execution Delayed of a query with good execution plan

One form of my application in very slow . In this form 2 query be executed. Trace level log of server show that first query is slow . in PL SQL when I execute query with same parameter , response time is less than 1 second. execution plan of…
0
votes
1 answer

Can SQL Developer SQL Tuning Advisor bind variables be null?

In SQL Developer (v 4.1) when I try to run the SQL Tuning Advisor on a query with one or more bind variables, if I leave any of them null, the SQL Tuning Advisor doesn't show any info at all. Is this a SQL Developer bug, or have I misunderstood…
hmqcnoesy
  • 4,165
  • 3
  • 31
  • 47
0
votes
2 answers

Query runs slow in one dataset, but faster in another bigger dataset; MSSQL server; Different execution plan. Why?

Here is the query: select nd1.ansos_id from nursdate nd1 where nd1.division_id = 2 and nd1.unit_id = 19 and nd1.nursdate_start_date = (select min(nd2.nursdate_start_date) from nursdate nd2 where nd2.ansos_id =…
riceball
  • 403
  • 2
  • 15
0
votes
0 answers

How to efficiently maintain daily stock for more than 1000 products in MySQL?

I'm having 1000+ Products. I need to maintain the stock on the daily basis. Product Table Schema CREATE TABLE Product ( ProductId INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, Name VARCHAR(30) NOT NULL, ) Stock Table Schema CREATE TABLE…
B.Balamanigandan
  • 4,713
  • 11
  • 68
  • 130
0
votes
1 answer

High Performance Dashboard with SQL Backend

Requirement: Set of Dashboards to be shown in a ERP Home-screen. Data is filtered according to the current user permissions. As of Now: High Chart is used for Data Visualization. Background Page is at C# .Net Problem : Every time user changes…
0
votes
3 answers

PostgreSQL 9.6 selects a wrong plan during aggregation against timestamp columns

I have a simple but pretty big table “log” that has three columns: user_id, day, hours. user_id character varying(36) COLLATE pg_catalog."default" NOT NULL, day timestamp without time zone, hours double precision All columns have indexes. The issue…
0
votes
2 answers

How to tune this query in Oracle 11g

I have been asked to tune the below query and would like to know if there is any better way to tune it? SELECT req_dtl.lab_ord_occ_test_id , req_dtl.order_ref_no , req_dtl.accession_no , req_dtl.test_code , …
kushi
  • 27
  • 1
  • 5
0
votes
2 answers

Query times out, millions of lines to sort when only tens of thousands to match

I'm trying to formulate a query that will find all users who have not had a transaction for a specified period of time. My problem is that my query is acting as if it gets caught in a nested loop. I'm trying to figure out where my logic is flawed.…
Tim Morton
  • 2,614
  • 1
  • 15
  • 23
0
votes
1 answer

join performance temp table in sql

In my database for somereasons not all table have foreign key then for have a better performance I used a select into (with data filtered) in a temp table , I did this for the tables I'll use for to have a better performance but now.... In the…
angel
  • 4,474
  • 12
  • 57
  • 89
0
votes
2 answers

Table Spool right before insert?

What I understand about SPOOL is to store data into a temporary table so SQL Server could use it when have CTE or other usage. Does that means SPOOL should appear in the middle of my execution plan? With the query below(I put SELECT * here to make…
0
votes
0 answers

PSQL vs Application SQL Execution Duration

I have an application executing a simple SQL command in PostgreSQL. When the application executes the request, the postgres log files show a duration time of 44 seconds (as does the application). However, if I use the PSQL CLI to execute that very…
Jordan
  • 904
  • 2
  • 12
  • 32
0
votes
0 answers

Temporary table creation takes long time RDS Server

Below query takes long time to create temporary table, its only have "228000" distinct record. DECLARE todate,fromdate DATETIME; SET fromdate=DATE_SUB(UTC_TIMESTAMP(),INTERVAL 2 DAY); SET todate=DATE_ADD(UTC_TIMESTAMP(),INTERVAL 14 DAY); SET…
Rk Singh
  • 17
  • 1
  • 11