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.
Questions tagged [sql-tuning]
328 questions
0
votes
1 answer
postgresql date filed query performance
i have two table . news table have 7m record and news_publish table have 70m record
when i execute this query took enormous amounts of time and very slow .
i add three index for tuning but query is slow.
when i google this problem i found that…

ali akbar azizkhani
- 2,213
- 5
- 31
- 48
0
votes
2 answers
Two insert sessions taking different time in production and uat in informatica
I have a same session running in production and UAT.All it does is seslects the data ( around 6k in both environments).Expression transformation (to hard code few columns) and then inserting into a table ( which does not have partitions).
The…

karthik adiga
- 133
- 2
- 12
0
votes
1 answer
Reading from XML data from SQL Server reduces performance
I am having a SQL view of the below script. As the table stores the data as XML (dbo.TEST.configuration), I have to select each column by reading the xml data. But when the record increases, it is getting too slow to load. Is there any method to…

Justin
- 378
- 1
- 3
- 12
0
votes
0 answers
Program a query to cancel if it is running too long?
I am trying to tune a query and would like to test a few pieces during after hours, when there isn't a lot of traffic on the server. I am going to benchmark the individual queries and write the results to a table to check in the morning,…

Sam Cohen-Devries
- 2,025
- 2
- 18
- 35
0
votes
0 answers
Determine a minimum ID is a known thecnic to optimize queries?
I have a table with around 50 million of rows, and I need to do queries often. I realize that when I determine what is the minimum ID in where clause, the query is very faster.
For example:
select * from huge_table
where date <= '2016-03-01'
and…

deldev
- 1,296
- 18
- 27
0
votes
1 answer
Improve the performance
I have two sets of data coming from external source - purchase date of the customer and last email click/open date of the customer. This is stored in two tables PURCHASE_INTER AND ACTIVITY_INTER tables respectively. Purchase data is in multiple and…

Sammy Pawar
- 1,201
- 3
- 19
- 38
0
votes
1 answer
Stored procedure runs slow on the first run
I have a job that runs daily and executes dozens of stored procedures.
Most of them run just fine, but several of them recently started taking a while to run (4-5 minutes).
When I come in in the morning and try to troubleshoot them, they only take…

Tamila
- 177
- 1
- 3
- 17
0
votes
1 answer
Teradata SQL Tuning Multiple columns in a huge table being joined to the same table with OR condition on the filter
This looked simple enough because there was just 1 col in the sel but I am not getting a tuning approach.
sel distinct (ColID ) from 1Billiontb btb
Join smalltb1 stb1 on btb.col_1=stb1.col_1
Join stb2 on btb.col_2=stb2.col_2
join stb3 …

user1874594
- 2,277
- 1
- 25
- 49
0
votes
1 answer
Query performance - Brain teaser
Consider that a table has 2 columns,
column_1 has 60% distinct values and column_2 has 40% distinct
values.
Both has same data type, say integer
If one has to apply the indexes on this table, which column he should chose to index? why?

Santosh Kangane
- 377
- 1
- 3
- 12
0
votes
4 answers
For long stored procedures, how to quickly identity the most time-consuming part?
Sometimes we need to deal with long stored procedure to make them run faster. What's the best way to quickly identify which part of the code is the slowest part? For me I just add some PRINT statement in the stored procedure and run it, then I can…

Just a learner
- 26,690
- 50
- 155
- 234
0
votes
1 answer
Teradata - report for top "stats hoggers"
Trying to compile a "statistics Hoggers" report . All those users who hogged away CPU running statistics On what "table.cols" ( or col1,col2 etc) , did they run stats and when they ran it.
I wrote the below report but I can see its far from real…

user1874594
- 2,277
- 1
- 25
- 49
0
votes
1 answer
Making JDBC insert query faster
I am fetching data from a master table(oracle) and keep adding it to Entity List until the whole data is fetched. The master table has 45 columns. Then I traverse the list and insert each row into my local table(oracle).
The schema for local table…

Jaydeep
- 149
- 2
- 5
- 19
0
votes
0 answers
Teradata MaxParseTree other that DBSControl is there any other factor
A report is throwing this error
insufficient parser memory , during optimizer phase
I am aware of the DBSControl parameter and how it relates to this.
My Questions are
Best of my K, the it would be a nay... but I just wanted to check ...is…

user1874594
- 2,277
- 1
- 25
- 49
0
votes
1 answer
Efficient query to delete records based on multiple conditions
I have a table as below:
CREATE TABLE product
(
PRODUCT NVARCHAR2(20) NOT NULL,
TYPE NUMBER(5) NOT NULL,
ID NUMBER(10) NOT NULL,
addDATE DATE …

user2077648
- 951
- 7
- 27
- 42
0
votes
0 answers
teradata SQL : redistribution by join column causes 98% skew
Wea re on Teradata 14.
2 Tables being LOJ . Each table PI has ONLY 1.5% SKEW . When ANY of these tables is being redestributed on the others Join key the spool table has a 98% skew and the query will just HANG UP on the merge join step
sel A.x ,…

Jason Reeves
- 11
- 9