mathematical formula

SQLServerCentral Article

Optimize Your SQL by Reformulating the Spec

  • Article

As SQL developers, we tend to think of performance tuning in terms of crafting the best table indices, avoiding scalar and table valued functions, and analyzing query plans (among other things). But sometimes going back to the spec and applying some properties of elementary math can be the best way to begin to improve performance of SQL queries which implement mathematical formulas. This article is a case study of how I used this technique to optimize my SQL implementation of the Inverse Simpson Index.

(3)

You rated this post out of 5. Change rating

2021-05-07 (first published: )

5,389 reads

Blogs

An LLM Saved My ATtiny85 From Certain Death

By

I almost ordered parts for a circuit that would have destroyed itself the instant...

I recommend Smart Brevity (book) for communications

By

Following the advice in Smart Brevity improves communication.

SQL Server 2025 Developer Edition – One size fits all

By

Microsoft has released SQL Server 2025, bringing big improvements to its main database engine....

Read the latest Blogs

Forums

Which Table I

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Which Table I

Using Python notebooks to save money in Fabric: The Fabric Modern Data Platform

By John Miner

Comments posted to this topic are about the item Using Python notebooks to save...

Your AI Successes

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Your AI Successes

Visit the forum

Question of the Day

Which Table I

I have this code in SQL Server 2022:

CREATE SCHEMA etl;
GO
CREATE TABLE etl.product
(
    ProductID INT,
    ProductName VARCHAR(100)
);
GO
INSERT etl.product
VALUES
(2, 'Bee AI Wearable');
GO
CREATE TABLE dbo.product
(
    ProductID INT,
    ProductName VARCHAR(100)
);
GO
INSERT dbo.product
VALUES
(1, 'Spiral College-ruled Notebook');
GO
CREATE OR ALTER PROCEDURE etl.GettheProduct
AS
BEGIN
    SELECT  ProductName
    FROM product;
END;
GO
When I execute this code as a user whose default schema is dbo and has rights to the tables and proc, what is returned?

See possible answers