Stay Ahead, Stay ONMINE

Practical SQL Puzzles That Will Level Up Your Skill

There are some Sql patterns that, once you know them, you start seeing them everywhere. The solutions to the puzzles that I will show you today are actually very simple SQL queries, but understanding the concept behind them will surely unlock new solutions to the queries you write on a day-to-day basis. These challenges are all based on real-world scenarios, as over the past few months I made a point of writing down every puzzle-like query that I had to build. I also encourage you to try them for yourself, so that you can challenge yourself first, which will improve your learning! All queries to generate the datasets will be provided in a PostgreSQL and DuckDB-friendly syntax, so that you can easily copy and play with them. At the end I will also provide you a link to a GitHub repo containing all the code, as well as the answer to the bonus challenge I will leave for you! I organized these puzzles in order of increasing difficulty, so, if you find the first ones too easy, at least take a look at the last one, which uses a technique that I truly believe you won’t have seen before. Okay, let’s get started. I love this puzzle because of how short and simple the final query is, even though it deals with many edge cases. The data for this challenge shows tickets moving in between Kanban stages, and the objective is to find how long, on average, tickets stay in the Doing stage. The data contains the ID of the ticket, the date the ticket was created, the date of the move, and the “from” and “to” stages of the move. The stages present are New, Doing, Review, and Done. Some things you need to know (edge cases): Tickets can move backwards, meaning tickets can go back to the Doing stage. You should not include tickets that are still stuck in the Doing stage, as there is no way to know how long they will stay there for. Tickets are not always created in the New stage. “`SQL CREATE TABLE ticket_moves ( ticket_id INT NOT NULL, create_date DATE NOT NULL, move_date DATE NOT NULL, from_stage TEXT NOT NULL, to_stage TEXT NOT NULL ); “` “`SQL INSERT INTO ticket_moves (ticket_id, create_date, move_date, from_stage, to_stage) VALUES — Ticket 1: Created in “New”, then moves to Doing, Review, Done. (1, ‘2024-09-01’, ‘2024-09-03’, ‘New’, ‘Doing’), (1, ‘2024-09-01’, ‘2024-09-07’, ‘Doing’, ‘Review’), (1, ‘2024-09-01’, ‘2024-09-10’, ‘Review’, ‘Done’), — Ticket 2: Created in “New”, then moves: New → Doing → Review → Doing again → Review. (2, ‘2024-09-05’, ‘2024-09-08’, ‘New’, ‘Doing’), (2, ‘2024-09-05’, ‘2024-09-12’, ‘Doing’, ‘Review’), (2, ‘2024-09-05’, ‘2024-09-15’, ‘Review’, ‘Doing’), (2, ‘2024-09-05’, ‘2024-09-20’, ‘Doing’, ‘Review’), — Ticket 3: Created in “New”, then moves to Doing. (Edge case: no subsequent move from Doing.) (3, ‘2024-09-10’, ‘2024-09-16’, ‘New’, ‘Doing’), — Ticket 4: Created already in “Doing”, then moves to Review. (4, ‘2024-09-15’, ‘2024-09-22’, ‘Doing’, ‘Review’); “` A summary of the data: Ticket 1: Created in the New stage, moves normally to Doing, then Review, and then Done. Ticket 2: Created in New, then moves: New → Doing → Review → Doing again → Review. Ticket 3: Created in New, moves to Doing, but it is still stuck there. Ticket 4: Created in the Doing stage, moves to Review afterward. It might be a good idea to stop for a bit and think how you would deal with this. Can you find out how long a ticket stays on a single stage? Honestly, this sounds intimidating at first, and it looks like it will be a nightmare to deal with all the edge cases. Let me show you the full solution to the problem, and then I will explain what is happening afterward. “`SQL WITH stage_intervals AS (     SELECT         ticket_id,         from_stage,         move_date          – COALESCE(             LAG(move_date) OVER (                 PARTITION BY ticket_id                  ORDER BY move_date             ),              create_date         ) AS days_in_stage     FROM         ticket_moves ) SELECT     SUM(days_in_stage) / COUNT(DISTINCT ticket_id) as avg_days_in_doing FROM     stage_intervals WHERE     from_stage = ‘Doing’; “` The first CTE uses the LAG function to find the previous move of the ticket, which will be the time the ticket entered that stage. Calculating the duration is as simple as subtracting the previous date from the move date. What you should notice is the use of the COALESCE in the previous move date. What that does is that if a ticket doesn’t have a previous move, then it uses the date of creation of the ticket. This takes care of the cases of tickets being created directly into the Doing stage, as it still will properly calculate the time it took to leave the stage. This is the result of the first CTE, showing the time spent in each stage. Notice how the Ticket 2 has two entries, as it visited the Doing stage in two separate occasions. With this done, it’s just a matter of getting the average as the SUM of total days spent in doing, divided by the distinct number of tickets that ever left the stage. Doing it this way, instead of simply using the AVG, makes sure that the two rows for Ticket 2 get properly accounted for as a single ticket. Not so bad, right? The goal of this second challenge is to find the most recent contract sequence of every employee. A break of sequence happens when two contracts have a gap of more than one day between them.  In this dataset, there are no contract overlaps, meaning that a contract for the same employee either has a gap or ends a day before the new one starts. “`SQL CREATE TABLE contracts (     contract_id integer PRIMARY KEY,     employee_id integer NOT NULL,     start_date date NOT NULL,     end_date date NOT NULL ); INSERT INTO contracts (contract_id, employee_id, start_date, end_date) VALUES      — Employee 1: Two continuous contracts     (1, 1, ‘2024-01-01’, ‘2024-03-31’),     (2, 1, ‘2024-04-01’, ‘2024-06-30’),     — Employee 2: One contract, then a gap of three days, then two contracts     (3, 2, ‘2024-01-01’, ‘2024-02-15’),     (4, 2, ‘2024-02-19’, ‘2024-04-30’),     (5, 2, ‘2024-05-01’, ‘2024-07-31’),     — Employee 3: One contract     (6, 3, ‘2024-03-01’, ‘2024-08-31’); “` As a summary of the data: Employee 1: Has two continuous contracts. Employee 2: One contract, then a gap of three days, then two contracts. Employee 3: One contract. The expected result, given the dataset, is that all contracts should be included except for the first contract of Employee 2, which is the only one that has a gap. Before explaining the logic behind the solution, I would like you to think about what operation can be used to join the contracts that belong to the same sequence. Focus only on the second row of data, what information do you need to know if this contract was a break or not? I hope it’s clear that this is the perfect situation for window functions, again. They are incredibly useful for solving problems like this, and understanding when to use them helps a lot in finding clean solutions to problems. First thing to do, then, is to get the end date of the previous contract for the same employee with the LAG function. Doing that, it’s simple to compare both dates and check if it was a break of sequence. “`SQL WITH ordered_contracts AS (     SELECT         *,         LAG(end_date) OVER (PARTITION BY employee_id ORDER BY start_date) AS previous_end_date     FROM         contracts ), gapped_contracts AS (     SELECT         *,         — Deals with the case of the first contract, which won’t have         — a previous end date. In this case, it’s still the start of a new         — sequence.         CASE WHEN previous_end_date IS NULL             OR previous_end_date < start_date – INTERVAL '1 day' THEN             1         ELSE             0         END AS is_new_sequence     FROM         ordered_contracts ) SELECT * FROM gapped_contracts ORDER BY employee_id ASC; “` An intuitive way to continue the query is to number the sequences of each employee. For example, an employee who has no gap, will always be on his first sequence, but an employee who had 5 breaks in contracts will be on his 5th sequence. Funnily enough, this is done by another window function. “`SQL — — Previous CTEs — sequences AS (     SELECT         *,         SUM(is_new_sequence) OVER (PARTITION BY employee_id ORDER BY start_date) AS sequence_id FROM     gapped_contracts ) SELECT * FROM sequences ORDER BY employee_id ASC; “` Notice how, for Employee 2, he starts his sequence #2 after the first gapped value. To finish this query, I grouped the data by employee, got the value of their most recent sequence, and then did an inner join with the sequences to keep only the most recent one. “`SQL — — Previous CTEs — max_sequence AS (     SELECT         employee_id,         MAX(sequence_id) AS max_sequence_id FROM     sequences GROUP BY     employee_id ), latest_contract_sequence AS (     SELECT         c.contract_id,         c.employee_id,         c.start_date,         c.end_date     FROM         sequences c         JOIN max_sequence m ON c.sequence_id = m.max_sequence_id             AND c.employee_id = m.employee_id         ORDER BY             c.employee_id,             c.start_date ) SELECT     * FROM     latest_contract_sequence; “` As expected, our final result is basically our starting query just with the first contract of Employee 2 missing!  Finally, the last puzzle — I’m glad you made it this far.  For me, this is the most mind-blowing one, as when I first encountered this problem I thought of a completely different solution that would be a mess to implement in SQL. For this puzzle, I’ve changed the context from what I had to deal with for my job, as I think it will make it easier to explain.  Imagine you’re a data analyst at an event venue, and you’re analyzing the talks scheduled for an upcoming event. You want to find the time of day where there will be the highest number of talks happening at the same time. This is what you should know about the schedules: Rooms are booked in increments of 30min, e.g. from 9h-10h30. The data is clean, there are no overbookings of meeting rooms. There can be back-to-back meetings in a single meeting room. Meeting schedule visualized (this is the actual data).  “`SQL CREATE TABLE meetings (     room TEXT NOT NULL,     start_time TIMESTAMP NOT NULL,     end_time TIMESTAMP NOT NULL ); INSERT INTO meetings (room, start_time, end_time) VALUES     — Room A meetings     ('Room A', '2024-10-01 09:00', '2024-10-01 10:00'),     ('Room A', '2024-10-01 10:00', '2024-10-01 11:00'),     ('Room A', '2024-10-01 11:00', '2024-10-01 12:00'),     — Room B meetings     ('Room B', '2024-10-01 09:30', '2024-10-01 11:30'),     — Room C meetings     ('Room C', '2024-10-01 09:00', '2024-10-01 10:00'),     ('Room C', '2024-10-01 11:30', '2024-10-01 12:00'); “` The way to solve this is using what is called a Sweep Line Algorithm, or also known as an event-based solution. This last name actually helps to understand what will be done, as the idea is that instead of dealing with intervals, which is what we have in the original data, we deal with events instead. To do this, we need to transform every row into two separate events. The first event will be the Start of the meeting, and the second event will be the End of the meeting. “`SQL WITH events AS (   — Create an event for the start of each meeting (+1)   SELECT      start_time AS event_time,      1 AS delta   FROM meetings   UNION ALL   — Create an event for the end of each meeting (-1)   SELECT     — Small trick to work with the back-to-back meetings (explained later)     end_time – interval '1 minute' as end_time,     -1 AS delta   FROM meetings ) SELECT * FROM events; “` Take the time to understand what is happening here. To create two events from a single row of data, we’re simply unioning the dataset on itself; the first half uses the start time as the timestamp, and the second part uses the end time. You might already notice the delta column created and see where this is going. When an event starts, we count it as +1, when it ends, we count it as -1. You might even be already thinking of another window function to solve this, and you’re actually right! But before that, let me just explain the trick I used in the end dates. As I don’t want back-to-back meetings to count as two concurrent meetings, I’m subtracting a single minute of every end date. This way, if a meeting ends and another starts at 10h30, it won’t be assumed that two meetings are concurrently happening at 10h30. Okay, back to the query and yet another window function. This time, though, the function of choice is a rolling SUM. “`SQL — — Previous CTEs — ordered_events AS (   SELECT     event_time,     delta,     SUM(delta) OVER (ORDER BY event_time, delta DESC) AS concurrent_meetings   FROM events ) SELECT * FROM ordered_events ORDER BY event_time DESC; “` The rolling SUM at the Delta column is essentially walking down every record and finding how many events are active at that time. For example, at 9 am sharp, it sees two events starting, so it marks the number of concurrent meetings as two! When the third meeting starts, the count goes up to three. But when it gets to 9h59 (10 am), then two meetings end, bringing the counter back to one. With this data, the only thing missing is to find when the highest value of concurrent meetings happens. “`SQL — — Previous CTEs — max_events AS (   — Find the maximum concurrent meetings value   SELECT      event_time,      concurrent_meetings,     RANK() OVER (ORDER BY concurrent_meetings DESC) AS rnk   FROM ordered_events ) SELECT event_time, concurrent_meetings FROM max_events WHERE rnk = 1; “` That’s it! The interval of 9h30–10h is the one with the largest number of concurrent meetings, which checks out with the schedule visualization above! This solution looks incredibly simple in my opinion, and it works for so many situations. Every time you are dealing with intervals now, you should think if the query wouldn’t be easier if you thought about it in the perspective of events. But before you move on, and to really nail down this concept, I want to leave you with a bonus challenge, which is also a common application of the Sweep Line Algorithm. I hope you give it a try! Bonus challenge The context for this one is still the same as the last puzzle, but now, instead of trying to find the period when there are most concurrent meetings, the objective is to find bad scheduling. It seems that there are overlaps in the meeting rooms, which need to be listed so it can be fixed ASAP. How would you find out if the same meeting room has two or more meetings booked at the same time? Here are some tips on how to solve it: It’s still the same algorithm. This means you will still do the UNION, but it will look slightly different. You should think in the perspective of each meeting room. You can use this data for the challenge: “`SQL CREATE TABLE meetings_overlap (     room TEXT NOT NULL,     start_time TIMESTAMP NOT NULL,     end_time TIMESTAMP NOT NULL ); INSERT INTO meetings_overlap (room, start_time, end_time) VALUES     — Room A meetings     ('Room A', '2024-10-01 09:00', '2024-10-01 10:00'),     ('Room A', '2024-10-01 10:00', '2024-10-01 11:00'),     ('Room A', '2024-10-01 11:00', '2024-10-01 12:00'),     — Room B meetings     ('Room B', '2024-10-01 09:30', '2024-10-01 11:30'),     — Room C meetings     ('Room C', '2024-10-01 09:00', '2024-10-01 10:00'),     — Overlaps with previous meeting.     ('Room C', '2024-10-01 09:30', '2024-10-01 12:00'); “` If you’re interested in the solution to this puzzle, as well as the rest of the queries, check this GitHub repo. The first takeaway from this blog post is that window functions are overpowered. Ever since I got more comfortable with using them, I feel that my queries have gotten so much simpler and easier to read, and I hope the same happens to you. If you’re interested in learning more about them, you would probably enjoy reading this other blog post I’ve written, where I go over how you can understand and use them effectively. The second takeaway is that these patterns used in the challenges really do happen in many other places. You might need to find sequences of subscriptions, customer retention, or you might need to find overlap of tasks. There are many situations when you will need to use window functions in a very similar fashion to what was done in the puzzles. The third thing I want you to remember is about this solution to using events besides dealing with intervals. I’ve looked at some problems I solved a long time ago that I could’ve used this pattern on to make my life easier, and unfortunately, I didn’t know about it at the time. I really do hope you enjoyed this post and gave a shot to the puzzles yourself. And I’m sure that if you made it this far, you either learned something new about SQL or strengthened your knowledge of window functions!  Thank you so much for reading. If you have questions or just want to get in touch with me, don’t hesitate to contact me at mtrentz.com. All images by the author unless stated otherwise.

There are some Sql patterns that, once you know them, you start seeing them everywhere. The solutions to the puzzles that I will show you today are actually very simple SQL queries, but understanding the concept behind them will surely unlock new solutions to the queries you write on a day-to-day basis.

These challenges are all based on real-world scenarios, as over the past few months I made a point of writing down every puzzle-like query that I had to build. I also encourage you to try them for yourself, so that you can challenge yourself first, which will improve your learning!

All queries to generate the datasets will be provided in a PostgreSQL and DuckDB-friendly syntax, so that you can easily copy and play with them. At the end I will also provide you a link to a GitHub repo containing all the code, as well as the answer to the bonus challenge I will leave for you!

I organized these puzzles in order of increasing difficulty, so, if you find the first ones too easy, at least take a look at the last one, which uses a technique that I truly believe you won’t have seen before.

Okay, let’s get started.

I love this puzzle because of how short and simple the final query is, even though it deals with many edge cases. The data for this challenge shows tickets moving in between Kanban stages, and the objective is to find how long, on average, tickets stay in the Doing stage.

The data contains the ID of the ticket, the date the ticket was created, the date of the move, and the “from” and “to” stages of the move. The stages present are New, Doing, Review, and Done.

Some things you need to know (edge cases):

  • Tickets can move backwards, meaning tickets can go back to the Doing stage.
  • You should not include tickets that are still stuck in the Doing stage, as there is no way to know how long they will stay there for.
  • Tickets are not always created in the New stage.
```SQL

CREATE TABLE ticket_moves (
    ticket_id INT NOT NULL,
    create_date DATE NOT NULL,
    move_date DATE NOT NULL,
    from_stage TEXT NOT NULL,
    to_stage TEXT NOT NULL
);

```
```SQL

INSERT INTO ticket_moves (ticket_id, create_date, move_date, from_stage, to_stage)
    VALUES
        -- Ticket 1: Created in "New", then moves to Doing, Review, Done.
        (1, '2024-09-01', '2024-09-03', 'New', 'Doing'),
        (1, '2024-09-01', '2024-09-07', 'Doing', 'Review'),
        (1, '2024-09-01', '2024-09-10', 'Review', 'Done'),
        -- Ticket 2: Created in "New", then moves: New → Doing → Review → Doing again → Review.
        (2, '2024-09-05', '2024-09-08', 'New', 'Doing'),
        (2, '2024-09-05', '2024-09-12', 'Doing', 'Review'),
        (2, '2024-09-05', '2024-09-15', 'Review', 'Doing'),
        (2, '2024-09-05', '2024-09-20', 'Doing', 'Review'),
        -- Ticket 3: Created in "New", then moves to Doing. (Edge case: no subsequent move from Doing.)
        (3, '2024-09-10', '2024-09-16', 'New', 'Doing'),
        -- Ticket 4: Created already in "Doing", then moves to Review.
        (4, '2024-09-15', '2024-09-22', 'Doing', 'Review');
```

A summary of the data:

  • Ticket 1: Created in the New stage, moves normally to Doing, then Review, and then Done.
  • Ticket 2: Created in New, then moves: New → Doing → Review → Doing again → Review.
  • Ticket 3: Created in New, moves to Doing, but it is still stuck there.
  • Ticket 4: Created in the Doing stage, moves to Review afterward.

It might be a good idea to stop for a bit and think how you would deal with this. Can you find out how long a ticket stays on a single stage?

Honestly, this sounds intimidating at first, and it looks like it will be a nightmare to deal with all the edge cases. Let me show you the full solution to the problem, and then I will explain what is happening afterward.

```SQL

WITH stage_intervals AS (
    SELECT
        ticket_id,
        from_stage,
        move_date 
        - COALESCE(
            LAG(move_date) OVER (
                PARTITION BY ticket_id 
                ORDER BY move_date
            ), 
            create_date
        ) AS days_in_stage
    FROM
        ticket_moves
)
SELECT
    SUM(days_in_stage) / COUNT(DISTINCT ticket_id) as avg_days_in_doing
FROM
    stage_intervals
WHERE
    from_stage = 'Doing';
```

The first CTE uses the LAG function to find the previous move of the ticket, which will be the time the ticket entered that stage. Calculating the duration is as simple as subtracting the previous date from the move date.

What you should notice is the use of the COALESCE in the previous move date. What that does is that if a ticket doesn’t have a previous move, then it uses the date of creation of the ticket. This takes care of the cases of tickets being created directly into the Doing stage, as it still will properly calculate the time it took to leave the stage.

This is the result of the first CTE, showing the time spent in each stage. Notice how the Ticket 2 has two entries, as it visited the Doing stage in two separate occasions.

With this done, it’s just a matter of getting the average as the SUM of total days spent in doing, divided by the distinct number of tickets that ever left the stage. Doing it this way, instead of simply using the AVG, makes sure that the two rows for Ticket 2 get properly accounted for as a single ticket.

Not so bad, right?

The goal of this second challenge is to find the most recent contract sequence of every employee. A break of sequence happens when two contracts have a gap of more than one day between them. 

In this dataset, there are no contract overlaps, meaning that a contract for the same employee either has a gap or ends a day before the new one starts.

```SQL
CREATE TABLE contracts (
    contract_id integer PRIMARY KEY,
    employee_id integer NOT NULL,
    start_date date NOT NULL,
    end_date date NOT NULL
);

INSERT INTO contracts (contract_id, employee_id, start_date, end_date)
VALUES 
    -- Employee 1: Two continuous contracts
    (1, 1, '2024-01-01', '2024-03-31'),
    (2, 1, '2024-04-01', '2024-06-30'),
    -- Employee 2: One contract, then a gap of three days, then two contracts
    (3, 2, '2024-01-01', '2024-02-15'),
    (4, 2, '2024-02-19', '2024-04-30'),
    (5, 2, '2024-05-01', '2024-07-31'),
    -- Employee 3: One contract
    (6, 3, '2024-03-01', '2024-08-31');
```

As a summary of the data:

  • Employee 1: Has two continuous contracts.
  • Employee 2: One contract, then a gap of three days, then two contracts.
  • Employee 3: One contract.

The expected result, given the dataset, is that all contracts should be included except for the first contract of Employee 2, which is the only one that has a gap.

Before explaining the logic behind the solution, I would like you to think about what operation can be used to join the contracts that belong to the same sequence. Focus only on the second row of data, what information do you need to know if this contract was a break or not?

I hope it’s clear that this is the perfect situation for window functions, again. They are incredibly useful for solving problems like this, and understanding when to use them helps a lot in finding clean solutions to problems.

First thing to do, then, is to get the end date of the previous contract for the same employee with the LAG function. Doing that, it’s simple to compare both dates and check if it was a break of sequence.

```SQL
WITH ordered_contracts AS (
    SELECT
        *,
        LAG(end_date) OVER (PARTITION BY employee_id ORDER BY start_date) AS previous_end_date
    FROM
        contracts
),
gapped_contracts AS (
    SELECT
        *,
        -- Deals with the case of the first contract, which won't have
        -- a previous end date. In this case, it's still the start of a new
        -- sequence.
        CASE WHEN previous_end_date IS NULL
            OR previous_end_date < start_date - INTERVAL '1 day' THEN
            1
        ELSE
            0
        END AS is_new_sequence
    FROM
        ordered_contracts
)
SELECT * FROM gapped_contracts ORDER BY employee_id ASC;
```

An intuitive way to continue the query is to number the sequences of each employee. For example, an employee who has no gap, will always be on his first sequence, but an employee who had 5 breaks in contracts will be on his 5th sequence. Funnily enough, this is done by another window function.

```SQL
--
-- Previous CTEs
--
sequences AS (
    SELECT
        *,
        SUM(is_new_sequence) OVER (PARTITION BY employee_id ORDER BY start_date) AS sequence_id
FROM
    gapped_contracts
)
SELECT * FROM sequences ORDER BY employee_id ASC;
```

Notice how, for Employee 2, he starts his sequence #2 after the first gapped value. To finish this query, I grouped the data by employee, got the value of their most recent sequence, and then did an inner join with the sequences to keep only the most recent one.

```SQL
--
-- Previous CTEs
--
max_sequence AS (
    SELECT
        employee_id,
        MAX(sequence_id) AS max_sequence_id
FROM
    sequences
GROUP BY
    employee_id
),
latest_contract_sequence AS (
    SELECT
        c.contract_id,
        c.employee_id,
        c.start_date,
        c.end_date
    FROM
        sequences c
        JOIN max_sequence m ON c.sequence_id = m.max_sequence_id
            AND c.employee_id = m.employee_id
        ORDER BY
            c.employee_id,
            c.start_date
)
SELECT
    *
FROM
    latest_contract_sequence;
```

As expected, our final result is basically our starting query just with the first contract of Employee 2 missing! 

Finally, the last puzzle — I’m glad you made it this far. 

For me, this is the most mind-blowing one, as when I first encountered this problem I thought of a completely different solution that would be a mess to implement in SQL.

For this puzzle, I’ve changed the context from what I had to deal with for my job, as I think it will make it easier to explain. 

Imagine you’re a data analyst at an event venue, and you’re analyzing the talks scheduled for an upcoming event. You want to find the time of day where there will be the highest number of talks happening at the same time.

This is what you should know about the schedules:

  • Rooms are booked in increments of 30min, e.g. from 9h-10h30.
  • The data is clean, there are no overbookings of meeting rooms.
  • There can be back-to-back meetings in a single meeting room.

Meeting schedule visualized (this is the actual data). 

```SQL
CREATE TABLE meetings (
    room TEXT NOT NULL,
    start_time TIMESTAMP NOT NULL,
    end_time TIMESTAMP NOT NULL
);

INSERT INTO meetings (room, start_time, end_time) VALUES
    -- Room A meetings
    ('Room A', '2024-10-01 09:00', '2024-10-01 10:00'),
    ('Room A', '2024-10-01 10:00', '2024-10-01 11:00'),
    ('Room A', '2024-10-01 11:00', '2024-10-01 12:00'),
    -- Room B meetings
    ('Room B', '2024-10-01 09:30', '2024-10-01 11:30'),
    -- Room C meetings
    ('Room C', '2024-10-01 09:00', '2024-10-01 10:00'),
    ('Room C', '2024-10-01 11:30', '2024-10-01 12:00');
```

The way to solve this is using what is called a Sweep Line Algorithm, or also known as an event-based solution. This last name actually helps to understand what will be done, as the idea is that instead of dealing with intervals, which is what we have in the original data, we deal with events instead.

To do this, we need to transform every row into two separate events. The first event will be the Start of the meeting, and the second event will be the End of the meeting.

```SQL
WITH events AS (
  -- Create an event for the start of each meeting (+1)
  SELECT 
    start_time AS event_time, 
    1 AS delta
  FROM meetings
  UNION ALL
  -- Create an event for the end of each meeting (-1)
  SELECT 
   -- Small trick to work with the back-to-back meetings (explained later)
    end_time - interval '1 minute' as end_time,
    -1 AS delta
  FROM meetings
)
SELECT * FROM events;
```

Take the time to understand what is happening here. To create two events from a single row of data, we’re simply unioning the dataset on itself; the first half uses the start time as the timestamp, and the second part uses the end time.

You might already notice the delta column created and see where this is going. When an event starts, we count it as +1, when it ends, we count it as -1. You might even be already thinking of another window function to solve this, and you’re actually right!

But before that, let me just explain the trick I used in the end dates. As I don’t want back-to-back meetings to count as two concurrent meetings, I’m subtracting a single minute of every end date. This way, if a meeting ends and another starts at 10h30, it won’t be assumed that two meetings are concurrently happening at 10h30.

Okay, back to the query and yet another window function. This time, though, the function of choice is a rolling SUM.

```SQL
--
-- Previous CTEs
--
ordered_events AS (
  SELECT
    event_time,
    delta,
    SUM(delta) OVER (ORDER BY event_time, delta DESC) AS concurrent_meetings
  FROM events
)
SELECT * FROM ordered_events ORDER BY event_time DESC;
```

The rolling SUM at the Delta column is essentially walking down every record and finding how many events are active at that time. For example, at 9 am sharp, it sees two events starting, so it marks the number of concurrent meetings as two!

When the third meeting starts, the count goes up to three. But when it gets to 9h59 (10 am), then two meetings end, bringing the counter back to one. With this data, the only thing missing is to find when the highest value of concurrent meetings happens.

```SQL
--
-- Previous CTEs
--
max_events AS (
  -- Find the maximum concurrent meetings value
  SELECT 
    event_time, 
    concurrent_meetings,
    RANK() OVER (ORDER BY concurrent_meetings DESC) AS rnk
  FROM ordered_events
)
SELECT event_time, concurrent_meetings
FROM max_events
WHERE rnk = 1;
```

That’s it! The interval of 9h30–10h is the one with the largest number of concurrent meetings, which checks out with the schedule visualization above!

This solution looks incredibly simple in my opinion, and it works for so many situations. Every time you are dealing with intervals now, you should think if the query wouldn’t be easier if you thought about it in the perspective of events.

But before you move on, and to really nail down this concept, I want to leave you with a bonus challenge, which is also a common application of the Sweep Line Algorithm. I hope you give it a try!

Bonus challenge

The context for this one is still the same as the last puzzle, but now, instead of trying to find the period when there are most concurrent meetings, the objective is to find bad scheduling. It seems that there are overlaps in the meeting rooms, which need to be listed so it can be fixed ASAP.

How would you find out if the same meeting room has two or more meetings booked at the same time? Here are some tips on how to solve it:

  • It’s still the same algorithm.
  • This means you will still do the UNION, but it will look slightly different.
  • You should think in the perspective of each meeting room.

You can use this data for the challenge:

```SQL
CREATE TABLE meetings_overlap (
    room TEXT NOT NULL,
    start_time TIMESTAMP NOT NULL,
    end_time TIMESTAMP NOT NULL
);

INSERT INTO meetings_overlap (room, start_time, end_time) VALUES
    -- Room A meetings
    ('Room A', '2024-10-01 09:00', '2024-10-01 10:00'),
    ('Room A', '2024-10-01 10:00', '2024-10-01 11:00'),
    ('Room A', '2024-10-01 11:00', '2024-10-01 12:00'),
    -- Room B meetings
    ('Room B', '2024-10-01 09:30', '2024-10-01 11:30'),
    -- Room C meetings
    ('Room C', '2024-10-01 09:00', '2024-10-01 10:00'),
    -- Overlaps with previous meeting.
    ('Room C', '2024-10-01 09:30', '2024-10-01 12:00');
```

If you’re interested in the solution to this puzzle, as well as the rest of the queries, check this GitHub repo.

The first takeaway from this blog post is that window functions are overpowered. Ever since I got more comfortable with using them, I feel that my queries have gotten so much simpler and easier to read, and I hope the same happens to you.

If you’re interested in learning more about them, you would probably enjoy reading this other blog post I’ve written, where I go over how you can understand and use them effectively.

The second takeaway is that these patterns used in the challenges really do happen in many other places. You might need to find sequences of subscriptions, customer retention, or you might need to find overlap of tasks. There are many situations when you will need to use window functions in a very similar fashion to what was done in the puzzles.

The third thing I want you to remember is about this solution to using events besides dealing with intervals. I’ve looked at some problems I solved a long time ago that I could’ve used this pattern on to make my life easier, and unfortunately, I didn’t know about it at the time.


I really do hope you enjoyed this post and gave a shot to the puzzles yourself. And I’m sure that if you made it this far, you either learned something new about SQL or strengthened your knowledge of window functions! 

Thank you so much for reading. If you have questions or just want to get in touch with me, don’t hesitate to contact me at mtrentz.com.

All images by the author unless stated otherwise.

Shape
Shape
Stay Ahead

Explore More Insights

Stay ahead with more perspectives on cutting-edge power, infrastructure, energy,  bitcoin and AI solutions. Explore these articles to uncover strategies and insights shaping the future of industries.

Shape

FortiBleed campaign exposes 75,000 Fortinet firewalls worldwide

“Attribution is ongoing, but the operational fingerprints are clear,” SOCRadar researchers said in a blog post, adding that the tooling and targeting choices are consistent with Russian-speaking threat actors. According to independent analyses, including by SOCRadar, Hudson Rock, and security researcher Kevin Beaumont, the threat actors systematically collected configuration files from

Read More »

Cisco: AI growth is exposing campus network limits

“Usually, networks are designed for consistent traffic, like SaaS and CRM traffic, and there aren’t a lot of unpredictable traffic patterns,” said the head of AI strategy for global IT and network engineering operations at a large U.S. technology company who participated in the research. “Suddenly, three AI agents are

Read More »

AMD acquires MEXT to add predictive memory optimization to its AI stack

Gogia said predictive memory tiering addresses inefficiencies that often leave expensive DRAM underutilized, but cautioned that optimization should complement, rather than replace, sound infrastructure design. “Predictive tiering attacks the waste inside that reflex,” he said, referring to the tendency to address performance challenges by purchasing more memory instead of improving

Read More »

FPSO ready for Santos-led Barossa LNG project

BW Offshore completed the Interim Performance Test (IPT) for the BW Opal floating production, storage, and offloading vessel (FPSO) as part of the commissioning program for the Santos Ltd.-operated Barossa LNG project about 285 km offshore from Darwin in the Northern Territory of Australia. The milestone is part of early-stage technical testing and adjustments following  first gas from the FPSO in September and the beginning of flow from subsea wells. BW Offshore confirmed that key production, processing, and utility systems on the FPSO were operating in an integrated manner and capable of delivering stable performance under production conditions. Following the restart of production in early May, BW Opal has continued gas production and export. Production is being managed in close coordination with Santos during this phase of the ramp-up and commissioning program. BW Opal contains a 358-m hull and accommodation for up to 140 personnel. It has gas handling capacity of 850 MMscfd and condensate handling capacity of 11,000 b/d. The FPSO will feed the Darwin LNG plant for the next two decades. The Barossa LNG project consists of the FPSO, a subsea production system, supporting in-field subsea infrastructure, a gas export pipeline, and a Darwin pipeline duplication. Up to eight subsea wells are planned (six wells from three drill centers) with contingency plans for an additional two wells. Gas and condensate is gathered from the wells through the subsea production system and then brought to the FPSO via a network of subsea infrastructure. Santos operates the Barossa LNG project (50%) with joint venture partners PRISM Energy International Australia Pty Ltd. (37.5%) and JERA Australia (12.5%).

Read More »

Equinor mulls additional Johan Sverdrup development phase

Equinor Energy AS is considering further development of the Johan Sverdrup area resources in the North Sea. Production from discoveries in Tonjer west and east and Geitungen would form the basis for the maturation of a potential phase 4 development in the northern part of the field. The volumes would be developed via subsea tieback to existing Johan Sverdrup infrastructure. Tonjer lies in the northernmost part of the Geitungen terrace in the Johan Sverdrup area. Oil was discovered in the area, but volumes and potential have been uncertain. The drilling of two appraisal wells and a sidetrack have provided a more precise assessment of the resource base.  Preliminary estimates for Tonjer and Geitungen combined are 20-30 MMboe. Further analyses of subsurface data will form the basis for more precise resource estimates. Phase 4 is now being matured towards an investment decision with a possible production start-up in 2029. Johan Sverdrup Johan Sverdrup, which accounts for about one third of Norwegian oil production, lies on the Utsira High (Utsirahøyden) in the central part of the North Sea, 65 km northeast of Sleipner field in water depths of 115 m. The main reservoir contains oil in Upper Jurassic intra-Draupne sandstone. The reservoir depth is 1,900 m. The quality of the main reservoir is excellent with very high permeability. The remaining oil resources are in sandstone in the Upper Triassic Statfjord Group and Middle to Upper Jurassic Vestland Group, as well as in spiculites in the Upper Jurassic Viking Group. Oil was also proven in Permian Zechstein carbonates. Equinor is operator of Johan Sverdrup (42.62%) with partners Aker BP (31.57%), Petoro (17.36%), and TotalEnergies (8.44%).

Read More »

Beacon advances deepwater Gulf developments with Monument, Zephyrus field work

Beacon Offshore Energy LLC is advancing two deepwater Gulf of Mexico developments, having drilled the first development well at Monument field and brought a second production well online at Zephyrus field. At Monument in Walker Ridge Block 315, the first development well reached a total depth of 32,250 ft and encountered 245 ft of net pay (true vertical thickness) in Lower Wilcox reservoirs, confirming pre-drill expectations for reservoir quality, the operator said. Beacon will continue drilling a second development well before completing the initial two-well program. First oil from the Wilcox development is expected before yearend 2026. Monument is being developed through a two-well, 17-mile subsea tieback to the Beacon-operated Shenandoah floating production system, which was designed as a regional host platform for developments in the northwestern Walker Ridge area, including Shenandoah, Monument, and Shenandoah South fields. Partners are Navitas Petroleum and Talos Energy Inc. At Zephyrus in Mississippi Canyon Block 759, production from the Zephyrus #2 well began in late April after the well was completed in first-quarter 2026. The well is producing from Miocene sands.  Combined with Zephyrus #1, which started production in late 2025, the field is expected to reach peak production of more than 20,000 boe/d. The Zephyrus development is tied back to the Shell plc-operated West Boreas subsea infrastructure, with production processed on the Olympus tension-leg platform in the Mars corridor. Partners are Houston Energy, HEQ II, Red Willow Offshore, Westlawn Americas Offshore, and Murphy Exploration & Production.

Read More »

Greece approves Chevron’s farm-in for offshore Block 10

Greece approved Chevron Corp.’s farm-in to offshore Block 10, clearing the way for the US major to complete its acquisition of a 70% interest and operatorship from HELLENiQ Energy. Greece’s Ministry of Environment and Energy and the Hellenic Hydrocarbon and Energy Resources Management Co. (HHRE) said June 15 that all administrative approvals have been completed for the transfer of the interest and operatorship. Chevron and HELLENiQ submitted the request for approval May 28. The companies also requested a 15-month extension of the second exploration phase for the block, which lies offshore the Kyparissia Gulf in the southern Ionian Sea. Following completion of the transfer, Chevron will hold a 70% interest and serve as operator, while HELLENiQ will retain the remaining 30%. Geological, geophysical, and environmental studies have been completed on the concession, including acquisition of 1,210 km of 2D seismic data in 2022 followed by 2,416 sq km of 3D seismic covering 88% of the block. The partners will use the seismic data to evaluate potential drilling targets before deciding whether to proceed to a third exploration phase, which includes an exploratory well. Chevron and HELLENiQ are already partners in four offshore concessions south of Crete and the Peloponnese, making Block 10 their fifth joint offshore license in Greece. Chevron said the agreement advances its strategy of expanding its exploration portfolio in the Eastern Mediterranean. Greek officials said the investment reflects confidence in the country’s offshore licensing framework and supports its long-term goal of strengthening Greece’s role in regional energy supply if exploration proves successful.

Read More »

Comstock farms out minority interest in midstream subsidiary for $600 million

@import url(‘https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap’); .ebm-page__main h1, .ebm-page__main h2, .ebm-page__main h3, .ebm-page__main h4, .ebm-page__main h5, .ebm-page__main h6 { font-family: Inter; } body { line-height: 150%; letter-spacing: 0.025em; } button, .ebm-button-wrapper { font-family: Inter; } .label-style { text-transform: uppercase; color: var(–color-grey); font-weight: 600; font-size: 0.75rem; } .caption-style { font-size: 0.75rem; opacity: .6; } #onetrust-pc-sdk [id*=btn-handler], #onetrust-pc-sdk [class*=btn-handler] { background-color: #c19a06 !important; border-color: #c19a06 !important; } #onetrust-policy a, #onetrust-pc-sdk a, #ot-pc-content a { color: #c19a06 !important; } #onetrust-consent-sdk #onetrust-pc-sdk .ot-active-menu { border-color: #c19a06 !important; } #onetrust-consent-sdk #onetrust-accept-btn-handler, #onetrust-banner-sdk #onetrust-reject-all-handler, #onetrust-consent-sdk #onetrust-pc-btn-handler.cookie-setting-link { background-color: #c19a06 !important; border-color: #c19a06 !important; } #onetrust-consent-sdk .onetrust-pc-btn-handler { color: #c19a06 !important; border-color: #c19a06 !important; } Comstock Resources Inc. sold a minority equity interest in its midstream subsidiary, Pinnacle Gas Services LLC, to certain funds managed by investment firm Sixth Street. Pinnacle provides gathering and treating services for Comstock’s Western Haynesville production through 246 miles of high-pressure pipeline and two gas treating plants. The infrastructure supports development of Comstock’s 540,000-net-acre Western Haynesville position, part of its 1,074,868 gross-acre (806,980 net) Haynesville/Bossier portfolio in Texas and Louisiana. Comstock is operating four rigs in the Western Haynesville this year as it continues delineating the play and expects to drill 21 wells and bring 20 online in 2026. The company also plans to operate five rigs in its legacy Haynesville position, where it expects to drill 50 wells and bring 48 online to support production growth through 2027. <!–> –><!–> –> Oct. 31, 2023 Sixth Street invested $600 million for a 27% equity interest in Pinnacle Gas Services, while Comstock Resources retains a 73% controlling interest and continues to manage and operate Pinnacle under a management services agreement. Under the terms of deal, Sixth Street’s ownership will be reduced to 19.5% when certain return thresholds are met, with Comstock’s interest increasing to 80.5%. Comstock chief

Read More »

Equinor aims to boost oil, gas production to 2.3 MMboe/d by 2030

Equinor ASA said it plans to increase oil and gas production to about 2.3 MMboe/d by 2030, supported by higher output from the Norwegian continental shelf (NCS) and international upstream growth.  The company, as part of its Capital Markets Day 2026, said it expects total production to rise by 150,000 boe/d by 2030, with NCS output increasing about 100,000 boe/d to 1.35 MMboe/d and international oil and gas production growing about 30% to roughly 950,000 boe/d. NCS-led upstream growth strategy Equinor described the NCS as the backbone of its upstream business and a key driver of long-term cash flow and value creation, with around 60% of capital expenditure directed to the basin. The operator plans to industrialize subsea field developments and increase recovery activity to accelerate resource maturation and reduce costs, targeting 6-8 new tieback projects per year toward 2035, noting the operating model shift aims to support a larger portfolio of subsea developments and increased recovery projects across the NCS. The NCS portfolio includes projects with break-even prices below US$35/bbl and payback times of less than 2.5 years. Continued increased recovery and exploration activity are expected to add new recoverable resources and extend field life, the company said. International oil and gas will account for about 30% of capital expenditure, with growth supported by assets in the United States, Brazil, Angola, the United Kingdom, and Canada. Across its international portfolio, production is expected to increase about 30% to roughly 950,000 boe/d by 2030. Total annual capex is guided to $11-13 billion in 2028-2030, following about $12 billion in 2027, including an additional $1 billion investment in high-return oil and gas projects that year.

Read More »

Edge networks a particular challenge for summer power, IT staffing needs

Power failures continue to dominate data center outage causes, accounting for 45% of impactful outages in Uptime Institute’s recently released 2026 Annual Outage Analysis report. While that figure declined from the previous year, it remains significantly higher than any other category. Within power-related incidents, UPS failures, transfer switch failures, and generator failures are the leading root causes. Uptime analysts said growing grid instability, power constraints, and high-density compute deployments are creating new pressure points for operators already running closer to capacity limits, according to a recent story on the report in Network World. Beyond power issues, hardware failures—particularly related to storage—also contribute to downtime. He noted that a lack of routine updates, especially to firmware, can make these problems worse, even when the underlying hardware is still functional.

Read More »

Turn enterprise AI into real business value with a secure, scalable factory

Building an enterprise AI factory is a complex endeavor that few organizations can tackle alone. The solution requires infrastructure capable of managing massive compute workloads generated by AI training and inferencing, high-capacity/low-latency networking within data centers and to the edge, and security to mitigate the risks that AI introduces. Abhinav Joshi, leader of AI solutions and product marketing at Cisco, identifies three key challenges inherent in building enterprise AI infrastructure: deployment complexity, security vulnerabilities, and performance bottlenecks. Agentic AI, with its heavy reliance on inferencing, places greater demands on infrastructure across all three dimensions. 3 challenges in building enterprise AI factories The deployment complexity challenge is driven by the need to quickly operationalize an AI infrastructure that fully integrates compute, networking, storage, security, and observability. A Kubernetes-based container management platform and a robust AI software toolchain are likewise essential to ensure the consistent development, testing, and deployment of containerized AI applications, Joshi says. The second challenge is mitigating security vulnerabilities. “Many organizations lack integrated security measures to protect the AI models, frameworks, applications, and the supporting infrastructure throughout the stack,” Joshi says. Attackers can exploit vulnerabilities by manipulating large language models (LLMs) with malicious inputs, which can disrupt operations and extract sensitive information. As AI agents ingest diverse data and act independently, they introduce new attack surfaces, including prompt injection, model poisoning, and data leaks.  Performance, especially around networking, is the third challenge. Tasks such as pre-training, post-training, and fine-tuning AI models, along with retrieval-augmented generation (RAG) pipelines and inferencing (including reasoning and agentic) all generate enormous amounts of network traffic. This creates severe bottlenecks across three critical communication paths: high-speed interconnects between graphics processing unit (GPU) servers, data throughput to storage layers, and real-time response delivery to end users. Without high-performance network connections, GPUs may be underutilized and jobs

Read More »

MSI’s Strategic Shift: From Server Vendor to Full-Spectrum AI Infrastructure Provider

The 100 kW rack figure places MSI’s offering squarely in the world of AI-era rack densities, where conventional air cooling becomes increasingly difficult or inefficient. The announcement also suggests that MSI is aligning with hyperscale and large cloud design principles, particularly through ORv3 and 48V power distribution. The company is moving from the “we have servers that can be liquid cooled” message, to “we can participate in rack-level AI infrastructure design.” The EIA air-cooled architecture, by contrast, is designed for more conventional data center environments. MSI says its 19-inch, 48RU EIA air-cooled rack supports standard deployments and can be configured with 16 2U2N multi-node systems, with AMD EPYC 9005 and Intel Xeon 6 platform options. That split matters because the AI infrastructure market is not moving in one uniform direction. Hyperscalers, neoclouds, and AI factories may move aggressively into ORv3, liquid cooling, busbar power, and rack-scale designs. Enterprise data centers, managed service providers, and colocation customers often need to work within existing 19-inch rack footprints and existing facility constraints. MSI wants to supply both markets. The CG681-S6093: MSI’s Flagship Liquid-Cooled AI Server The centerpiece of MSI’s NVIDIA-based AI server announcement is the CG681-S6093, a 6U liquid-cooled AI server based on NVIDIA MGX architecture. MSI says the system supports dual AMD EPYC processors and up to eight NVIDIA RTX PRO 6000 Blackwell Server Edition Liquid Cooled GPUs. It also supports 32 DDR5 DIMMs and NVIDIA ConnectX-8 SuperNICs with up to 8×400Gbps networking. This system is a direct entry into high-density AI inference, HPC, simulation, graphics, video, and physical AI workloads. The server is not positioned only for frontier model training. Instead, MSI appears to be aiming at the expanding middle of the AI infrastructure market: large inference clusters, visual computing, simulation, industrial AI, scientific computing, and agentic AI workloads. The next

Read More »

Cooling at AI Scale: Inside Motivair’s Blueprint for the Liquid-Cooled Data Center

BUFFALO, N.Y. — In the race to build AI infrastructure, the industry often focuses on GPUs, power availability, and the massive capital investments reshaping the digital infrastructure landscape. But a walk through Motivair’s manufacturing facility in Buffalo, as provided on the eve of the Motivair-Schneider Electric Global Press Event’s tour of the nearby Terawulf Lake Mariner AI campus, offers a reminder that another critical component of the AI boom is being built one coolant distribution unit at a time. During a recent Data Center Frontier Show podcast recorded at Motivair’s Buffalo headquarters, CEO Rich Whitmore described a reality that is becoming bedrock across the industry: Liquid cooling is now very far from being an emerging technology. It is now a prerequisite for deploying the most advanced AI systems. “You cannot deploy AI servers—at least the cutting-edge AI servers—without liquid cooling,” Whitmore said. That observation may be obvious to infrastructure veterans. Yet it points to a larger shift now underway across the data center ecosystem. As AI workloads drive rack densities beyond the practical limits of air cooling, thermal infrastructure has moved from a supporting role to a primary design consideration. For Whitmore and Motivair, that transition did not begin with ChatGPT. From Supercomputing to Commercial AI Long before AI became the defining growth story of the data center sector, Motivair was developing liquid cooling systems for high-performance computing and supercomputing environments. Whitmore describes today’s AI market as less of a technological revolution than a commercialization of capabilities that have existed for years inside elite computing environments. “We cut our teeth in high-performance computing and supercomputing,” Whitmore explained. “What we’re seeing today as we go into the AI era is really a commercialization of traditional supercomputing.” That experience has positioned Motivair differently than many newer entrants rushing into the liquid cooling

Read More »

From Components to AI Factories: Peter Panfil Says the Future of Data Centers Is All About Integration at Scale

ORLANDO, Fla. — For years, the data center industry optimized individual systems: power distribution, cooling, racks, UPS equipment, and mechanical infrastructure. In the AI era, according to Vertiv Distinguished Engineer and Vice President of Technical Business Development Peter Panfil, that approach is no longer sufficient. Speaking during Wednesday morning’s keynote at the 2026 7×24 Exchange Spring Conference, Panfil presented a vision in which the data center itself becomes a single, tightly orchestrated computing appliance—truly an “AI factory” whose success depends less on standalone components than on the seamless interaction between them. Throughout his presentation, titled “Scale at Speed: How Massively Parallel Compute GPUs Are Revolutionizing Data Center Design,” Panfil repeatedly returned to a single imperative: the AI infrastructure race is increasingly defined by execution velocity. “If you think you’re going big enough, go bigger,” he told attendees. “If you think you’re going fast enough, you’re going to have to go faster.” For an industry gathered under the conference’s overarching theme of future-proofing AI infrastructure, Panfil’s message suggested something subtly different. Rather than trying to predict the future, operators should build systems capable of adapting to it. “I would much rather be future ready,” he said, “than future proof.” Speed Becomes the New Competitive Metric One of the keynote’s recurring themes was that deployment speed has become an economic variable in its own right. Panfil argued that hyperscalers and AI providers increasingly view time-to-capacity as directly tied to business value, making delays in construction or commissioning far more expensive than traditional infrastructure inefficiencies. “The cost of speeding up has real benefits right now,” he observed. That urgency is changing the way facilities are assembled. Rather than coordinating numerous independent contractors and subsystem vendors on-site, Panfil described an emerging model built around highly standardized, factory-produced HAC [hot aisle containment] modules—or “hacks”—that arrive

Read More »

Beyond the GPU: Cisco Says AI’s Biggest Challenge May Be the Network That Connects It All

For much of the AI boom, the industry’s attention has centered on GPUs, power availability, and liquid cooling. But according to Cisco Senior Business Development Manager Robin Olds, another critical constraint is rapidly moving to the forefront: the network itself. Speaking with Data Center Frontier on the show floor at Fiber Connect 2026, Olds argued that AI represents a once-in-a-generation shift comparable to the birth of the commercial internet, fundamentally changing traffic patterns and forcing service providers, data center operators, hyperscalers, and emerging neoclouds to rethink infrastructure design. “It’s really like the internet when it was created,” Olds said. “We’re at another intersection in time where we could really see things happening.” AI Is Rewriting the Bandwidth Equation The most significant change may not be compute density alone but the sustained demand AI places on transport networks. According to Olds, service providers are already seeing AI traffic account for roughly 30% of utilization on backbone infrastructure; a dramatic increase from less than 1% only two years ago. As AI workloads continue to proliferate, those utilization levels are expected to rise further. The next wave of agentic AI could amplify that trend. Unlike consumer chatbots, which generate bursty request patterns, autonomous AI agents continuously interact with applications and external services, creating more persistent traffic flows. “Everything’s about chatbots,” Olds observed. “It’s very spiky—up, down. Agentic AI is going to maintain utilization because now I have agents working on my behalf.” For data center developers, network operators, and cloud providers alike, that implies planning not just for peak demand but for elevated baseline utilization across metro and long-haul infrastructure. Compressing the Network Stack Cisco’s response centers on architectural simplification. Olds highlighted the company’s Agile Services Networking framework, which combines router and optical networking technologies with coherent optics to converge functions that historically

Read More »

Microsoft will invest $80B in AI data centers in fiscal 2025

And Microsoft isn’t the only one that is ramping up its investments into AI-enabled data centers. Rival cloud service providers are all investing in either upgrading or opening new data centers to capture a larger chunk of business from developers and users of large language models (LLMs).  In a report published in October 2024, Bloomberg Intelligence estimated that demand for generative AI would push Microsoft, AWS, Google, Oracle, Meta, and Apple would between them devote $200 billion to capex in 2025, up from $110 billion in 2023. Microsoft is one of the biggest spenders, followed closely by Google and AWS, Bloomberg Intelligence said. Its estimate of Microsoft’s capital spending on AI, at $62.4 billion for calendar 2025, is lower than Smith’s claim that the company will invest $80 billion in the fiscal year to June 30, 2025. Both figures, though, are way higher than Microsoft’s 2020 capital expenditure of “just” $17.6 billion. The majority of the increased spending is tied to cloud services and the expansion of AI infrastructure needed to provide compute capacity for OpenAI workloads. Separately, last October Amazon CEO Andy Jassy said his company planned total capex spend of $75 billion in 2024 and even more in 2025, with much of it going to AWS, its cloud computing division.

Read More »

John Deere unveils more autonomous farm machines to address skill labor shortage

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More Self-driving tractors might be the path to self-driving cars. John Deere has revealed a new line of autonomous machines and tech across agriculture, construction and commercial landscaping. The Moline, Illinois-based John Deere has been in business for 187 years, yet it’s been a regular as a non-tech company showing off technology at the big tech trade show in Las Vegas and is back at CES 2025 with more autonomous tractors and other vehicles. This is not something we usually cover, but John Deere has a lot of data that is interesting in the big picture of tech. The message from the company is that there aren’t enough skilled farm laborers to do the work that its customers need. It’s been a challenge for most of the last two decades, said Jahmy Hindman, CTO at John Deere, in a briefing. Much of the tech will come this fall and after that. He noted that the average farmer in the U.S. is over 58 and works 12 to 18 hours a day to grow food for us. And he said the American Farm Bureau Federation estimates there are roughly 2.4 million farm jobs that need to be filled annually; and the agricultural work force continues to shrink. (This is my hint to the anti-immigration crowd). John Deere’s autonomous 9RX Tractor. Farmers can oversee it using an app. While each of these industries experiences their own set of challenges, a commonality across all is skilled labor availability. In construction, about 80% percent of contractors struggle to find skilled labor. And in commercial landscaping, 86% of landscaping business owners can’t find labor to fill open positions, he said. “They have to figure out how to do

Read More »

2025 playbook for enterprise AI success, from agents to evals

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More 2025 is poised to be a pivotal year for enterprise AI. The past year has seen rapid innovation, and this year will see the same. This has made it more critical than ever to revisit your AI strategy to stay competitive and create value for your customers. From scaling AI agents to optimizing costs, here are the five critical areas enterprises should prioritize for their AI strategy this year. 1. Agents: the next generation of automation AI agents are no longer theoretical. In 2025, they’re indispensable tools for enterprises looking to streamline operations and enhance customer interactions. Unlike traditional software, agents powered by large language models (LLMs) can make nuanced decisions, navigate complex multi-step tasks, and integrate seamlessly with tools and APIs. At the start of 2024, agents were not ready for prime time, making frustrating mistakes like hallucinating URLs. They started getting better as frontier large language models themselves improved. “Let me put it this way,” said Sam Witteveen, cofounder of Red Dragon, a company that develops agents for companies, and that recently reviewed the 48 agents it built last year. “Interestingly, the ones that we built at the start of the year, a lot of those worked way better at the end of the year just because the models got better.” Witteveen shared this in the video podcast we filmed to discuss these five big trends in detail. Models are getting better and hallucinating less, and they’re also being trained to do agentic tasks. Another feature that the model providers are researching is a way to use the LLM as a judge, and as models get cheaper (something we’ll cover below), companies can use three or more models to

Read More »

OpenAI’s red teaming innovations define new essentials for security leaders in the AI era

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More OpenAI has taken a more aggressive approach to red teaming than its AI competitors, demonstrating its security teams’ advanced capabilities in two areas: multi-step reinforcement and external red teaming. OpenAI recently released two papers that set a new competitive standard for improving the quality, reliability and safety of AI models in these two techniques and more. The first paper, “OpenAI’s Approach to External Red Teaming for AI Models and Systems,” reports that specialized teams outside the company have proven effective in uncovering vulnerabilities that might otherwise have made it into a released model because in-house testing techniques may have missed them. In the second paper, “Diverse and Effective Red Teaming with Auto-Generated Rewards and Multi-Step Reinforcement Learning,” OpenAI introduces an automated framework that relies on iterative reinforcement learning to generate a broad spectrum of novel, wide-ranging attacks. Going all-in on red teaming pays practical, competitive dividends It’s encouraging to see competitive intensity in red teaming growing among AI companies. When Anthropic released its AI red team guidelines in June of last year, it joined AI providers including Google, Microsoft, Nvidia, OpenAI, and even the U.S.’s National Institute of Standards and Technology (NIST), which all had released red teaming frameworks. Investing heavily in red teaming yields tangible benefits for security leaders in any organization. OpenAI’s paper on external red teaming provides a detailed analysis of how the company strives to create specialized external teams that include cybersecurity and subject matter experts. The goal is to see if knowledgeable external teams can defeat models’ security perimeters and find gaps in their security, biases and controls that prompt-based testing couldn’t find. What makes OpenAI’s recent papers noteworthy is how well they define using human-in-the-middle

Read More »