Tagged Questions
0
votes
1answer
14 views
Use timestamp(or datetime) as part of primary key (or part of clustered index)
I use following query frequently:
SELECT * FROM table WHERE Timestamp > [SomeTime] AND Timestamp < [SomeOtherTime] and publish = 1 and type = 2 order by Timestamp
I would like to optimize ...
0
votes
2answers
46 views
Splitting SQL query with many joins into smaller ones helps?
We need to do some reporting every night on our SQL server 2008R2. Calculating the reports takes several hours. In order to shorten the time we precalculate a table. This table is created based on ...
1
vote
2answers
29 views
How can I tune the PostgreSQL query optimizer when using SQL logical 'OR' and operator 'LIKE'?
How can I tune the PostgreSQL query plan (or the SQL query itself) to make more optimal use of available indexes when the query contains an SQL OR condition that uses the LIKE operator instead of =?
...
1
vote
3answers
44 views
What kind of indexes will help me in this MERGE query?
I have a table like this:
Name | TimeA | TimeB | ValueA | ValueB
And, I am performing some MERGE operations as follows:
CREATE TABLE #TEMP1...
INSERT INTO #TEMP1
SELECT Name, Value
FROM ...
0
votes
0answers
49 views
How to optimize CTE in SQL server
Below is my recursive query to get children and child of each children but it takes too long to execute. How can I optimize this query so that it can execute faster. If I remove distinct, it brings ...
1
vote
0answers
43 views
Why does SQL ignore an index hint and opt for a different index?
Given a table that has two indexes on it, one sorted in the reverse from the other and given these two queries.
Select value From SomeTable wITH (INDEX(IV_Sort_Asc))
Select value From SomeTable wITH ...
0
votes
1answer
28 views
How do you modify an SQL query to iteratate over every 100 results and then perform an outter query?
The following query:
DELETE FROM attachmentdata
WHERE attachmentid IN
( SELECT attachmentid
FROM attachments
WHERE pageid IN
( SELECT contentid FROM content_delete )
);
works ...
0
votes
2answers
38 views
Optimizing mysql Join query with date sorting
Simplifying the database/table structure i have a situation with two tables where we store 'items' and item properties (the relation between the two is 1-N)
I'm trying to optimize the following ...
1
vote
1answer
30 views
Using COLLECT STATISTICS in Teradata
In Teradata I can use a statement like ...
collect statistics on my_table column(col1)
This will gather stats on the table and store them in DBC views like ColumnStats, IndexStats and ...
0
votes
1answer
41 views
DB2 Performance CASE vs COALESCE
I'm modifying an existing statement that joins user information in one table so that the user info can come from another table. One is a permanent table and the other is temporary (records get moved ...
1
vote
1answer
48 views
SQL JOIN query Optimization with subqueries
I used below subquery for get attached records. i need to know is it Optimized query for my task (seems within three month its exists records more than 10,000 ).then is it support for that data load.?
...
0
votes
3answers
64 views
SQL subquery sort
Could one be so kind to assist me with a following:
I have a query that results in two columns one being straight (columnA) from a table while other generated from subquery (columnB). If I do a sort ...
2
votes
1answer
82 views
How to do the Recursive SELECT query in Mysql?
I got a following table:
col1 - col2 - col3
1 - a - 5
5 - d - 3
3 - k - 7
6 - o - 2
2 - 0 - 8
If a user searches for "1", the program will look at the col1 that has "1" then it will get a value in ...
1
vote
3answers
42 views
MySQL innoDB: Long time of query execution
I'm having troubles to run this SQL:
I think it's a index problem but I don't know because I dind't make this database and I'm just a simple programmer.
The problem is, that table has 64260 ...
1
vote
2answers
52 views
SQL: How to select one record per day, assuming that each day contain more than 1 value MySQL
I want to select records from '2013-04-01 00:00:00' to 'today' but, each day has lot of value, because they are saving each 15 minutes a value, so I want only the first or last value from each day.
...