Stay Tuned!

Subscribe to our newsletter to get our newest articles instantly!

Programming

How to handle the slow query in SQL

As you find challenges in writing or maintaining databases, especially for SQL Server, here I found something that I either forget or don’t realise.

Challenge

Facing this query that always returns more than 1 minute to run. I am checking about the index and I didn’t see anything significant.

Solution

When you join the table, ensure the data type between the 2 tables is the same. In my case, I had a fact table that has millions of records and join with the reference table. One is using INT data type and the other one is using BIGINT data type. I’ve changed the reference one to INT instead.

Credits

Photo by Manuel Geissinger: https://www.pexels.com/photo/black-server-racks-on-a-room-325229/

[Note: Pageviews – 3,396 – before migrated from the Dewalist Blog website on 09/08/2020]




Valdy

About Author

Valdy founded Dewacorp.com, a helpdesk and IT Services provider that has taken care of nearly 40,000 customer service requests in the past 15 years - nearly 2,600 per year. He also created the growing Dewalist.com - a classified website that has close to 110,000 page views and 9,000+ user visits per month with 61,000+ yearly published ads and 47,000 active registered users. He blogs for the ever-growing Dewapost.com, a tech blog that gets around 20,000 impressions per month with 700 clicks and 10 average pages first impressions on Google Search. You can reach him on the Contact Us page, social media links below or Dewachat.com.

You may also like

Programming

SQL: Performance Tuning Query

Queries — Basic setup DBCC DROPCLEANBUFFERSDBCC FREEPROCCACHE SET STATISTICS IO ONSET STATISTICS TIME ON /* SELECT * FROM dbo.Categories*/ Sources
Programming

Notes: Road to Yii Framework

Apache2 Configuration on MAC Snow Leopard: /etc/apache2/httpd.conf “It worksP page is located under: /Library/WebServer/Documents/index.html.en To restart apache2 after changing: sudo apachectl