Category: Blog

  • The Bucket List of Places

    I wrote an editorial about gathering data for my brain through experiences. For me this is mostly through travel and going to places, but this could be through a particular experience. For example, I used to want to do an adult fantasy baseball camp, though that’s not on my list. Skiing in Japan, however, is.

    I sat down and made a quick list here, things that stuck out in my mind, and I have an older bucket list, but I need to review and break some things down. I like some of what Brent Ozar has in an Epic Life Quest, and I might try to break my list into shorter term goals and longer ones as well.

    In the meantime, I’m making a list of places I want to visit. These are in a variety of forms, some cities, some attractions, but all places I’ve thought about. Now we’ll see if I get there:

      • Tokyo
      • Okinawa
      • Mt Fuji
      • Svalbard
      • Reykjavik
      • Antwerp/Bruges (planned 2022)
      • Lisbon
      • Rome
      • Florence
      • Venice
      • Cairo and the Great Pyramids
      • Istanbul
      • Cyprus
      • Jerusalem
      • Dubai
      • Cape Town
      • Johannesburg
      • Kenya and Mt Kilimanjaro
      • Madagascar
      • Singapore
      • Bangkok
      • Phuket
      • Ho Chi Minh City
      • Kathmandu
      • Beijing
      • Shanghai
      • Great Wall of China
      • Nepal, Mt Everest, Tibet
      • Taiwan
      • Manila
      • Jakarta
      • Dubai and Burj Khalifa
      • Auckland
      • Santiago
      • Machu Picchu (scheduled 2023)
      • Easter Island
      • Rio de Janeiro
      • Lima
      • Buenos Aires
      • Costa Rica
      • Virgin Islands
      • Bermuda
      • Juneau
      • Cabo San Lucas
      • Prince Edward Island
      • Denali (Mt McKinley)
  • Daily Coping 28 Apr 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to enjoy moving to your favorite music.

    It’s a travel day for me. I leave this evening for Reno to coach another volleyball tournament. This is our last competition of the year, so I’m going to try and enjoy things. We will be less focused on winning and more on having fun and getting kids to try new things.

    I’ll be in the airport and traveling to Lake Tahoe where we’re staying on the lake. I’ll be with my wife, but I’m going to take some headphones and enjoy music a bit through the airport and on the journey. Maybe some foot tapping or grooving to music a bit. I bet she’ll join me.

    Or laugh at me.

    Either way, it will be a smiley-day.

  • Database Design for Tracking Solar Production

    We had a solar system installed at our house this year. I’m excited to see how this performs, as our estimates and research shows this ought to be a good financial decision for us over time. While the hardware that came with the system includes some monitoring and reporting, I wanted to track things independently to be sure that I have the data. I know many of these companies might not be as prepared for an issue as I would like, and if they lose some of my historical data, I’m not sure they care.

    I decided to set up a small database, which will need an import process along with reporting and this is the first in a series of posts on how I’m addressing the database design. In this post, I’ll look at the initial tables I created.

    Estimated Production Table

    My system included some estimated levels of production for the year, and I will be able to record the actual levels each day. I decided to track these two sets of data separately for a couple reasons.

    First, the estimates are monthly, and they do not vary. While I could just stick this data in the same table, it’s a lot of wasted data. Not a lot of space, but still, I decided to be efficient here. The estimates I have are a total for each month, with the math done to give me a daily power level. I decided to create this table:

    CREATE TABLE [dbo].[SolarPowerEstimate](
         [TrackingKey] [int] IDENTITY(1,1) NOT NULL,
         [trackingmonth] [tinyint] NULL,
         [estimate_month] [numeric](6, 2) NULL,
         [estimate_daily] [numeric](4, 2) NULL,
      CONSTRAINT [SolarPowerPK] PRIMARY KEY CLUSTERED
    (
         [TrackingKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO

    This table has a PK just to keep things simple, and then I have a month number, which tracks for which month I have an estimate. There should only be 12 months in this table, as the estimate is supposed to repeat each year. I included the numeric values for the month and daily levels.

    The data in this table looks like this:

    2022-04-24 18_19_13-solartracking.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (54))_ - Micro

    I can join this with my actual production to compare how well things are working.

    Actual Production

    For Actual production, there is a value for each day. As a result, I need a date and a numeric value. I decided to separate out the date into separate parts, as I can always combine those, but this is really a data warehouse structure for me and I want to quickly join this with my estimate. I also expect to do some reporting by month, so having the month separated out (and the year) is a quick way to join data without needing a function.

    CREATE TABLE   [dbo].[solarpoweractual](
         [TrackingKey] [int] IDENTITY(1,1) NOT NULL,
         [trackingyear] [smallint] NULL,
         [trackingmonth] [tinyint] NULL,
         [trackingday] [tinyint] NULL,
         [actual_daily] [numeric](10, 4) NULL,
      CONSTRAINT [SolarPowerActualPK] PRIMARY KEY CLUSTERED
    (
         [TrackingKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO

    This  table will be populated with numbers for the date parts and then the production value. Right now, I see data like this:

    2022-04-24 18_22_39-solartracking.sql - ARISTOTLE_SQL2017.way0utwest (ARISTOTLE_Steve (54))_ - Micro

    I’ll go over reporting and how I use this data in another post, but there is one more table I need for this system.

    Staging Imports

    I can download data daily, but I really don’t care about the flows of the data each day. The data is reported each 15 minutes, but that’s a bit granular for me. Instead, I want to download monthly data. If I do that, I get a row for each day of the month, but some days are 0 if they are in the future. The current day is also incomplete until the sun goes down, so I may need to update that data regularly.

    Rather then try to parse the data and build a complex ETL process, I’m aiming for an ELT, with a T that moves data from a staging table to my actual table with an upsert process.

    The csv I get from my monitoring system is a date and a numeric value, so I built a staging table like this:

    CREATE TABLE [dbo].[SolarStaging](
         [Time] [date] NOT NULL,
         [System_Production_Wh] [varchar](50) NOT NULL
    ) ON [PRIMARY]
    GO

    My aim here is to truncate this table, load the entire CSV, and then transform data as needed.

    Summary

    That’s the basics of my solar tracking database. I have a place to land new data, a table for the estimates I have for each month of the year, and then a table that is essentially a fact table of actual values.

    I’ll add more details on how I load data, as well as how to analyze the data over time.

  • Daily Coping 27 Apr 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to spend less time sitting today, get up and move more often.

    The other day we did stretching and breathing. Today I’m going to do more walking. I am setting some reminders to take 5 minutes to walk a bit and move my body around other tasks. I might do 5 minutes of yoga a few times as well, maybe holding a few poses and just getting my heart pumping harder.

    2022-04-18 16_28_02-Calendar - steve.jones@red-gate.com - Outlook

    Somewhere in here I also need to get to the gym and lift a bit as well, but this will be a bit of movement.