How Much AI Code Would You Use?

  • Comments posted to this topic are about the item How Much AI Code Would You Use?

  • I have a simple approach to AI. I don't touch it at all. I certainly wouldn't use it to generate SQL as in the time it would take me to define the query I could have written it myself. I do use SQL Prompt as it saves me a lot of time looking up function and procedure definitions.

  • At present the percentage of AI generated code I use is very low but not zero.  I use it for things where I know exactly what I am trying to achieve and will know the right answer when I see it.  An example would be asking for help with a more complex Python list comprehension.

    For IAC (Infrastructure as Code) using Terraform I know the principles and what I want to achieve but my experience is less  so I lean on AI more.  I can still spot when something isn't correct.  The code still has to pass all linting, formatting, terraform validate  and tests too.

    My colleagues and I are finding that GitHub Co-Pilot auto-complete in VS Code is an annoyance rather than a help.  It leaps in with suggestions you don't want and gets it wrong more often than it gets it right.

    Co-pilot chat is more useful because it doesn't barge into your code.  Its the difference between having two trainees.  One is a hyperactive teenager who hasn't learned to listen.  The other is more mature.  It still makes mistakes but at least it takes into account.

    I don't seem to have the problems with AI to the same extent I notice others having.  There's an old joke about a wife asking her programmer husband to go to the shop and buy a pint of milk, if they have eggs buy 6.  So he comes back with 6 pints of milk rather than a pint of milk and half a dozen eggs.  I am Aspergers as are a few family members.  We have a precise way of communicating and supplying context.  Think  of using AI to produce code as being akin to a high level declarative language.

     

  • Absolutely ZERO.  In my opinion, AI is fundamentally flawed from the beginning.  It is based on all the wrong data and searches that have been amassed on the internet.  In Accounting speak - GIGO.  If I need assistance in solving a coding/script issue in SQL, I have my go-to sites (such as this one) where I can find how the true professionals already resolved my issue.  In some cases, I have added comments for better clarification or even solutions I have found.  But I would much rather read from the PROS then slosh my way through artificial-"intelligence".  The A in AI should scare everyone.  It is artificial, meaning fake.

     

    This response was solely and passionately generated by a human.

  • I would not say that AI writes 95% of my code, but it certainly allows me to write code twice as fast and has allowed me to tackle projects that I previously would not have due to the level of effort.

    I use a paid subscription to ChatGPT off hours for a variety of personal things like landscaping advice or summarizing rental agreements, but at work I use CoPilot, because it's bundled with my organization's Office365 subscription, and I don't want to co-mingle my personal and work related stuff. It is very useful for answering narrow but obscure technical questions that would otherwise require hours of Google searching and experimentation.

    Here are some examples of how I use CoPilot at work:

    CoPilot, I have archived historical data from a SQL Server table to parquet format and copied it to an Azure storage container. I now want to leverage Polybase to create a View that unionizes the archived data with the SQL Server table. Can you help get me started with this?

    (CoPilot provides 90% of the code that I need to get started, and I only provide url, security token, and other configuration)


    CoPilot, I need a regular expression that can match a string that has the suffix ' tot' and contains either 'user' or 'kernel'.

    CoPilot:

    Sure! Here's a regular expression that matches a string with the suffix ' tot' and contains either 'user' or 'kernel':

    .*(user|kernel).* tot$

    This expression works as follows:

    • .* matches any character (except for line terminators) zero or more times.
    • (user|kernel) matches either 'user' or 'kernel'.
    • .* matches any character zero or more times again.
    • tot$ ensures the string ends with ' tot'.

     

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • I don't have a measured number, but I'd guess at the moment, 60% or so of my code is initiated in an AI. It's a fantastic short hand to get started. I almost always have to edit what it gives me to dial it in to what I specifically need, but broad strokes, it does a great job to help me get started.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I don't use AI in my code.  I'm not against it, but I usually don't think about it.  The comment above with the regex example is a good one.  I would definitely use it for that.

    I think in general, it's easy to write easy SQL yourself.  AI time savings would be minimal, if any, since you have to feed it schema definitions.  AI would suck at complex SQL.  This would usually be SQL you have to craft with experimentation and refinements to get it to perform well.  These are the types of queries where non-DBA people give them to you and say they take hours to run, but you can apply your cool tricks to get it down to seconds.

    If I did more non-SQL coding, I think I'd embrace AI to help.  Sadly, I just don't get to do much of that.

    Be still, and know that I am God - Psalm 46:10

  • I've used AI for writing some C# code and for creating a framework for a personal website. In the case of the C# code, I probably generated 20% with AI. Just some things that I hadn't done before and it was quick enough to spit out what I needed without going down endless Google rabbit holes. The personal website was just a simple 4 page framework and Claude 3.5 made it quick and easy. That was about 95% AI generated with some tweaks. I haven't yet tried generating any T-SQL with AI.

    The difference between a junior dev generating 95% of their code in AI and a senior dev generating 95% of their code in AI is that the senior dev is going to be able to do a thorough code review of the AI code and the junior dev with less experience might accept code that has issues they can't see because they don't have the same level of experience.

    Just my 2c

  • Call me a dinosaur if you like, but I'm 100% with Alex Gay - don't use it and wouldn't use it for code I can write myself. Nearest thing I have to AI is SQL code that generates SQL  - scripts that create long MERGE stored proc using specified view for specified table and suchlike.

  • Here is another common DBA task that ChatGPT or CoPilot can assist with: analyzing query execution plans.

    It (probably) won't provide a complete fix for your queries or indexing for you, but if you provide it with the XML version of the plan, it can quickly point out things like tempdb spills, inefficient join operations, and implicit data type conversion.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • P Jones wrote:

    Call me a dinosaur if you like, but I'm 100% with Alex Gay - don't use it and wouldn't use it for code I can write myself. Nearest thing I have to AI is SQL code that generates SQL  - scripts that create long MERGE stored proc using specified view for specified table and suchlike.

    It's just a tool. Like any other. Tossing it out completely is missing some efficiency opportunities.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Tom Uellner wrote:

    The difference between a junior dev generating 95% of their code in AI and a senior dev generating 95% of their code in AI is that the senior dev is going to be able to do a thorough code review of the AI code and the junior dev with less experience might accept code that has issues they can't see because they don't have the same level of experience.

    Just my 2c

    Yeah, this is my concern with AI too. It feels like (zero demonstrable evidence for this BTW, just a feeling) that AI will be too big a crutch. It'll cover far too much of what junior people should be learning through trial & error. I suspect that the path from junior to senior is actually going to be harder because of AI.

    Mine's only worth 1.5c

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey wrote:

    Tom Uellner wrote:

    The difference between a junior dev generating 95% of their code in AI and a senior dev generating 95% of their code in AI is that the senior dev is going to be able to do a thorough code review of the AI code and the junior dev with less experience might accept code that has issues they can't see because they don't have the same level of experience.

    Just my 2c

    Yeah, this is my concern with AI too. It feels like (zero demonstrable evidence for this BTW, just a feeling) that AI will be too big a crutch. It'll cover far too much of what junior people should be learning through trial & error. I suspect that the path from junior to senior is actually going to be harder because of AI.

    Mine's only worth 1.5c

    Absolutely agree about there being zero demonstrable evidence but I have that feeling too. There are some funny videos up on YouTube about freshly minted dev vibe coders having AI do all their work. But for something to be funny, there usually needs to be a grain of truth for the bit to work. Hopefully we're both wrong and we have a great new crop of junior devs but it doesn't feel that way right now.

  • When would you say it's ok in just about any kine of business where it's OK for dates and times to round up to the day, week, month, quarter, or year?  Surely that happens a lot less the the 5% people are talking about

    "Good enough usually isn't".

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Grant Fritchey wrote:

    P Jones wrote:

    Call me a dinosaur if you like, but I'm 100% with Alex Gay - don't use it and wouldn't use it for code I can write myself. Nearest thing I have to AI is SQL code that generates SQL  - scripts that create long MERGE stored proc using specified view for specified table and suchlike.

    It's just a tool. Like any other. Tossing it out completely is missing some efficiency opportunities.

    Agree with Grant.

    The AI, despite the hype, isn't intended to replace humans. It's intended to assist. If you ask it to write code that you write in a certain way, that won't work well. It can with some RAG work, but overall, it's here to help you produce some code that is tedious and you don't want to type. The smaller the piece of code, the less I think GenAI helps. It's more with boilerplate, larger slices of things. Or for analysing a lot of code, like Eric noted, such as analyzing an XML Execution Plan.

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic. Login to reply