Questions tagged [query-tuning]
123 questions
0
votes
1 answer
Using indexes with where and join clauses
In a lecture note which I use to learn about database systems, I saw this sentence.
All columns involved in indexes should appear on WHERE and JOIN clauses on the same sequence they appear on index.
I found this one under the title SQL Query…

Lasitha Yapa
- 4,309
- 8
- 38
- 57
0
votes
2 answers
Restructure Inline view
SELECT MAX(column1)
FROM table1 B , table2 A, table3 H
WHERE B.unit=A.unit
AND B.value=A.value
AND B.unit=H.unit
AND B.value=H.value
AND A.number=1234
Can someone help me to restructure this query in inline view?
SAMPLE
Table1
------
Value Unit…

user1954762
- 159
- 1
- 3
- 11
0
votes
3 answers
How to Performance tune a query that has Between statement for range of dates
I am working on performance tuning all the slow running queries. I am new to Oracle have been using sql server for a while. Can someone help me tune the query to make it run faster.
Select distinct x.a, x.b from
from xyz_view x
where x.date_key…

SqlBrain
- 43
- 1
- 11
0
votes
1 answer
sybase iq explain plan
I am working on Sybase IQ 16 performance tuning. Looking for help from experts to tune my queries.
1)Is there a command that will generate plan output.
2)Is there any generic guidelines/steps to be followed to tune the query.

Binu Varghese
- 5
- 3
0
votes
1 answer
Mysql query very slow and not using proper index (By using group by, IN operator )
Below query was taking 5+ sec time to execute ( Table contains 1m+ records ).
Outer query was not using proper index it always fetching data by using FULL table scan.can someone help me how to optimize it..
Query
SELECT x
FROM UserCardXref x
…

Mahesh
- 61
- 1
- 8
0
votes
1 answer
How to improve the performance of this query
I have broken my head to try to create indices, or change mysql configuration to improve a query but I'm not getting it. Could someone help me?
I am creating a system that has more than four million products and to improve the response time for the…

Rodrigo Mendes
- 25
- 9
0
votes
3 answers
SQL Server - alternative to using NOT EXISTS
I have a list of about 200,000 records with EntityID column which I load into a temp table variable.
I want to insert any records from the Temp table variable if EntityID from the Temp table does not exist in the dbo.EntityRows table. The…

nanonerd
- 1,964
- 6
- 23
- 49
0
votes
1 answer
fast way to get number of records in mysql
I'm writing a query in mysql to join two tables. And both tables have more than 50,000 records.
Table EMP Columns
empid,
project,
code,
Status
Table EMPINFO
empid,
project,
code,
projecttype,
timespent,
skills
In each table there is candidate…

roy
- 101
- 1
- 3
- 9
0
votes
1 answer
Included index on table with 200+ million rows
I'm having difficulties creating an included index on table that contains slightly over 200 million records. The structure of table is as follows:
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](60) NOT NULL,
[VatId] [int] NOT…

Ivan Sivak
- 7,178
- 3
- 36
- 42
0
votes
0 answers
very large tables indexes
I have 2 large tables( millions of rows) having similar columns ( one staging , one master) querying on all most all columns .
all columns are VARCHAR(200)
MERGE
INTO [dbo].[TABLE1] [t1]
USING [dbo].[TABLE2] [t2]
ON [t1].[COL1] =…

OglaString
- 1
- 7
0
votes
1 answer
Mysql query is consuming too much space on disk
I'm trying to run the following query on mysql:
SELECT column1, column2, count(distinct t2.iduser)
FROM table1 t1
LEFT JOIN table2 t2 ON t2.id = t1.id
LEFT JOIN huge_table h ON h.column = t2.vouchercode
AND h.client IN (23, 42, 47, 50, 55, 54,…

deldev
- 1,296
- 18
- 27
0
votes
1 answer
Please help me to optimize the below mentioned script as the same table(i.e. Incident_Audit_log) has utilized multiple times?
select A.*
from Incident_Audit_log a where incident_audit_log_id in
(select top 1 incident_audit_log_id from Incident_Audit_log b
where b.incident_id=a.incident_id and b.status_did=a.status_did
and b.tracking_code_did =…

praveen
- 63
- 2
- 4
- 9
0
votes
1 answer
Postgres 9.4: How to fix Query Planner's Choice of Hash Join in ANY ARRAY lookup which runs 10x slower
I realize of course that figuring out these issues can be complex and require lots of info but I'm hoping there is a known issue or workaround for this particular case. I've narrowed down the change in the query that causes the sub-optimal query…

Sarus
- 3,303
- 1
- 23
- 27
0
votes
3 answers
Tuning oracle subquery in select statement
I have a master table and a reference table as below.
WITH MAS as (
SELECT 10 as CUSTOMER_ID, 1 PROCESS_ID, 44 PROCESS_TYPE, 200 as AMOUNT FROM DUAL UNION ALL
SELECT 10 as CUSTOMER_ID, 1 PROCESS_ID, 44 PROCESS_TYPE, 250 as AMOUNT FROM DUAL UNION…

Deniz
- 191
- 1
- 6
- 17
0
votes
2 answers
How to tune a query which is using DBLINK
My concern is, I have a remote view abc@DBLINK and a local table xyz.
I need to map a remote view and a local table and fetch a small amount of data from abc@DBLINK view and insert into some other local table say pst. i.e.
INSERT INTO pst
SELECT…

ShobhitSaxena
- 73
- 5
- 12