I wrote a function in the oracle database that calculates saldo and finds the date of the operation. Here’s how it works: He will receive Start subtracting the first cell of TURNOVER_DEBIT column …
Tag: query-performance
MySQL GROUP BY slows down query x1000 times
I’m struggling with setting up proper, effective index for my Django application which uses MySQL database. The problem is about article table which for now has a little more than 1 million rows and querying isn’t as fast as we want. Article table structure looks more or less like below: After many tries I came that below index gives best
Does using EXISTS instruction improves this query
Im learning how to improve some queries I have, for example I saw that using EXISTS over IN does better, so I did the following modification but im not 100% sure if im getting the same results I …
Does DB2 implement multi-table indexes?
I’m afraid this functionality may not exist [yet]. I wanted to use an index that spans multiple tables in DB2. I know Oracle and SQL server implement them (with more or less options) and that …
SQL Query Performance Enhancement on NOT IN
Suppose I have a query need to lookup users who bought book A but not bought book B. Typical SQL query can be: This not in query looks not efficient, any enhancement I can do this query? Answer Try using exists clause instead of IN clause – Apart from this you my try having index on below columns –
Sql View with WHERE clause runs slower than a raw query
This runs in a constant time: However, this one takes about 7 seconds: Component is a SQL view which consists of the first longer query without WHERE clause. Why this happens? Does the view retrieve all records and then apply Where clause? Is there a way to speed up the second query? (without applying indexes) Answer Why this happens? Does
SQL Server Query filter with order is slow
I have been struggling with this for a while. I have a database with three tables (each of which has millions of records) as follows (removed some columns for simplicity): There exists indexes As follows To eliminate the possibility that the slowness is because of the selected columns, I only select a fixed value The following query runs very fast
I wonder using INNER JOIN and equality operator is faster or using IN when I try to filter data from a table by another table’s column
While I’m trying to get all accounts, which received message from foo@gmail.com. I want to know about the performance of two following query. or Thanks! Answer Always use the first query in such situations. Don’t use DISTINCT inside an IN clause subquery, though. Don’t try to tell the DBMS how to perform the IN. (Well, a good DBMS should simply
Strange behavior of Oracle and group by
While analyzing performance of an SQL query in Oracle, I noticed a strange behavior. I noticed that Oracle’s plan behavior changes depending on value used in query. For example here is my table …
Oracle Selecting Index Optimisation
I need to optimise this query by using indexing. I tried to index some of the columns, but it is not helping. Is there anyone have thoughts? The query I need to optimise: Select vintage, wine_no, …