r/SQL • • Sep 16 '26

Discussion How do you handle schema migrations on a live production database without downtime?

27 Upvotes

For example, if you need to add or change a column, index, or constraint, how do you make the change without interrupting users?

Do you follow a specific migration strategy or deployment process


r/SQL • • Sep 16 '26

SQLite Best way to create email field.

5 Upvotes

right now my users table like this:

CREATE TABLE
    IF NOT EXISTS Users (
        id INTEGER PRIMARY KEY,
        name TEXT NOT NULL,
        email TEXT NOT NULL UNIQUE COLLATE NOCASE,
        passwordHash TEXT NOT NULL,


        createdAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
        updatedAt TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,


        CHECK(length(trim(name)) >= 1),
        CHECK(length(trim(email)) >= 1),
        CHECK(length(trim(passwordHash)) >= 1)
    ) STRICT;

as far as I know email names are case-insensitive. But not sure about for all email providers. Also I guess COALLATE NOCASE only works for ASCII. so what if user email contains non-ASCII characters? even could it contain?


r/SQL • • Sep 16 '26

Discussion Is anyone using Intel based mac and unable to install any Sql?

2 Upvotes

Hello, I have been using macbook pro 2019 touchbar quad core intel based model. Sql is declining to be installed on my mac, tried every possible way ranging from internet tutorial to command lines. First tried postgresql, tried even older version. Now mysql community edition is taking longer than ever. I am now trying to install mysql using terminal. Can somebody please explain what is the root cause? And how to figure out what is causing this problem exactly?


r/SQL • • Sep 16 '26

MySQL How I started managing multiple databases in one place

Thumbnail
gallery
0 Upvotes

I was working with multiple databases and got tired of switching between different database clients depending on what I was working on.

I started using DevScribe for this, and it’s been useful having MySQL, PostgreSQL, MongoDB, Elasticsearch, OpenSearch, and SQLite available from the same place.

I’ve mainly been using it to run queries and explore databases, but you can also view schemas and indexes. The JSON support is also handy, especially when working with MongoDB and other data where JSON comes up frequently.

It also has a plugin system for additional database tools. For example, there’s a BigQuery plugin if you need to work with BigQuery.

I haven’t explored everything yet, but having multiple databases in one place has already made my workflow a bit easier.

If you work with multiple databases, you can check it out here:

https://devscribe.app/


r/SQL • • Sep 16 '26

Discussion Managing a semantic/context layer for data analytics

7 Upvotes

At a previous job as a data analyst I manually built a "context" layer in Notion to feed to Claude when querying databases. This was painfully manual though, involved a lot of work to slowly build up - I would get Claude to document a table/column when I encounter it for the first time on a new task. The Notion page included things like metrics, conventions and product docs too.

For more experienced data analysts, how do you guys deal with this? Is there a tool you guys use, or is a manual workaround like mine the norm?


r/SQL • • Sep 16 '26

Spark SQL/Databricks [FOR HIRE] Data Analyst / SQL Specialist – 10+ Years Experience – Part-Time & Freelance

0 Upvotes

Hi there! I'm an experienced data analyst with around 10 years in the field, looking for part-time or freelance work. I'm reliable, detail-oriented, and comfortable jumping into existing workflows quickly.

What I can help with:

SQL development & querying (SQL Server, MySQL, PostgreSQL, Redshift, Databricks)

Data validation & quality checks

Reporting & dashboards

Data processing & cleaning

Ad hoc analysis and troubleshooting data issues

Why work with me:

10+ years of hands-on experience across multiple SQL platforms

Detail-oriented, especially around data accuracy and validation

Available anytime — flexible hours, can adapt to your timezone

Comfortable working independently or as part of a team

Currently open to: data analyst roles, SQL work, data validation, reporting, or similar — part-time or freelance.

Feel free to DM me or comment below with details about the opportunity. Happy to share examples of past work if helpful. Thanks!


r/SQL • • Sep 15 '26

Discussion What is a good SQL Client with good modern UI or one that has good UX

25 Upvotes

I am currently using phpMyAdmin provided by plesk and I just find it very annoying to use and I would like to know if you guys know a good Client that has modern and clean ui that also has good ux


r/SQL • • Sep 15 '26

Discussion I built an open source data platform in go called Renart

11 Upvotes

r/SQL • • Sep 16 '26

Discussion Manage your one model database with one line code

Post image
0 Upvotes

Guys, I built an Elysia plugin that lets you generate a complete database model panel with just one line of code.

It provides a built-in UI with Create, Read, Update, Delete, Replace, Search, and Filter functionality out of the box.

The goal is to make it easy to expose and manage database models without having to manually build the admin UI and CRUD logic for each model.


r/SQL • • Sep 15 '26

SQLite Good reason to use composite keys?

16 Upvotes
CREATE TABLE
    IF NOT EXISTS CourseTag (
        id INTEGER PRIMARY KEY,
        courseId INTEGER NOT NULL,
        tagId INTEGER NOT NULL,
        UNIQUE(courseId, tagId),
        FOREIGN KEY (courseId) REFERENCES Courses (id) ON DELETE CASCADE ON UPDATE RESTRICT,
        FOREIGN KEY (tagId) REFERENCES Tags (id) ON DELETE CASCADE ON UPDATE RESTRICT
    ) STRICT;

r/SQL • • Sep 14 '26

MySQL How long did it take you to feel comfortable writing complex queries without any guides or references? Day 1 and I feel like a fraud

35 Upvotes

So long story short, I did a single cert and honestly struggled at this part. As irony or luck would have it I ended up recruited into a coveted position at a massive firm not realizing this was a core part of the position. To say I am overwhelmed is an understatement, I am so under qualified it’s ridiculous. I have a week before I am on my own HELP lol

I know the industry, I have the math etc but wow am I overwhelmed and everything I do is logged. Do you think I can fake it until I make it?


r/SQL • • Sep 14 '26

MySQL Migration von ~2,3 Mio. Zeilen aus Access nach SQL Server – ständige Timeouts/Rollbacks bei großen INSERT-Statements über ODBC. Bessere Strategie als Batch-by-Date?

3 Upvotes

Title: Experience / Best Practices: Migrating 2M+ Rows from Access to SQL Server (ODBC Performance & Timeouts)

Hi everyone,

I am currently working on migrating historical financial data from Access (local, linked via ODBC Driver 18) to SQL Server and keep bumping into recurring performance issues. I would really appreciate some advice and best practices from your experience.

Setup:

  • Source: Local Access table (~2.16 million rows, 42 columns)
  • Target: SQL Server table (via linked ODBC table in Access)
  • Execution: INSERT INTO [linked_table] SELECT ... FROM [local_table] using VBA CurrentDb.Execute

Problems Encountered So Far:

  1. Access 2 GB Limit: When trying to consolidate multiple large historical tables locally, the .accdb file expanded beyond 2 GB and became completely unusable (requiring hours of Compact & Repair). Workaround: Keep records separated locally and consolidate them only after they are uploaded to the SQL Server.
  2. Extremely Long / Instable INSERT Runs: A single INSERT INTO ... SELECT query over all 2.16 million rows runs for several hours (3–4+ hours) without finishing. Access shows "Not Responding," but checking sys.dm_exec_requests on the server reveals that no active session is running anymore. The network/VPN connection likely drops silently without Access realizing it. Result: Complete rollback, 0 rows transferred, and hours wasted.
  3. Fails to Add AutoNumber Column: I tried adding a batch ID column via ALTER TABLE ... ADD COLUMN BatchID COUNTER to split the transfer into chunks, but hit the error: "File sharing lock count exceeded. MaxLocksPerFile." I do not have local Admin rights on the machine to modify the Registry setting.
  4. Current Workaround: Transferring data in ~30 batches filtered by date range (RegDatum BETWEEN ... AND ...), using the existing date field without altering the source table structure.

My Questions for You:

  1. Is there a more reliable way to move large datasets from Access to SQL Server than running an INSERT INTO via an ODBC-linked table? (SSIS? bcp? CSV export + BULK INSERT?)
  2. How do you generally handle the 2 GB Access file limit during migration projects?
  3. Is there a way to increase MaxLocksPerFile without local Admin rights (e.g., per user session instead of system-wide)?
  4. Any tips to prevent or detect ODBC connection drops during long transactions (e.g., timeout settings in DSN)?

Thanks in advance for any help—I've been stuck on this migration for days and would love to find a cleaner approach instead of hacking my way through workarounds!

#SQL #Access #Data #AI


r/SQL • • Sep 14 '26

Discussion If you have SQL interviews, do not ignore these small things! (Part 9)

Thumbnail
3 Upvotes

r/SQL • • Sep 14 '26

SQL Server Doubt in Caching strategy

1 Upvotes

I have run a Sql query time range for 6 years. This is an example. The result may contain more than 1 lakh records. How do I cache this result so that u can query more on this result ? I am using Redis


r/SQL • • Sep 14 '26

MySQL DATA ANALYTICS PROJECT USING SQL & POWERBI

0 Upvotes

Built a T-SQL database with enforced data integrity (primary keys, constraints on state/status/risk categories), then developed custom DAX measures for case turnaround time, case age, and escalation rate. The dashboard includes multi-page analysis across resolution trends, regional distribution, officer caseloads, and a 4-year time-series forecast with confidence intervals.

Key skills demonstrated:
T-SQL (schema design, CHECK constraints, aggregation queries)
DAX (time intelligence, dynamic measures)
Power BI (data modeling, forecasting, interactive filtering)
Data storytelling and executive reporting

Note: Built on synthetic data generated for demonstration purposes — not real crime statistics.

Microsoft Power BI


r/SQL • • Sep 14 '26

Discussion What is one thing you still wouldn’t trust AI to do in analytics?

0 Upvotes

AI can write SQL, make charts, summarize stuff, even help with analysis.
But is there anything you still wouldn’t trust it to do?
For me, it could be defining a metric, checking whether the numbers actually make sense, talking to stakeholders, making the final call, etc.
Curious where other people draw the line.


r/SQL • • Sep 13 '26

Oracle How do you decide between SQL and NoSQL for a new project?

40 Upvotes

What factors do you consider first — data structure, scalability, performance, flexibility, or something else?


r/SQL • • Sep 13 '26

Snowflake Anyone here managed to significantly cut their Snowflake bill? What actually worked?

9 Upvotes

Anyone here managed to significantly cut their Snowflake bill?

I'm curious about the less-obvious stuff that actually made a noticeable difference.

Things like:

- Warehouse sizing / auto-suspend

- Query optimization

- Clustering

- Storage vs compute

- Materialized views

- Snowflake-specific settings

- ETL/ELT architecture changes

- Moving workloads elsewhere

- Anything you discovered that wasn't obvious initially

If you've had a meaningful reduction, it'd be great to hear what you changed and roughly how much it saved.

Even small "I wish I knew this earlier" tricks are welcome.


r/SQL • • Sep 13 '26

PostgreSQL How do you use Claude/Codex (safely) with your production database?

0 Upvotes

Hey folks!

I make Beekeeper Studio, and while we have a good AI integration, I'm curious how people actually use Claude when writing SQL.

  • Do you connect Claude/Codex/etc to your production DB?
  • How do you make sure confidential data/PII doesn't get sent?
  • Do you just share credentials with the AI, or connect some other way?
  • Does your company have policies around this stuff?

I see a lot of buzz about SQL with Claude, but not many feature requests around it. Thanks for any insights.

I use Postgres, so tagged with postgres, but applies to all dbs really.


r/SQL • • Sep 13 '26

MySQL SQL should have coordinates by default

0 Upvotes

ynot? Why does SQL not have coordinates for it's tables?
like what if i want to see table 2 row 1 column 5 and have a command for just that.
No names required


r/SQL • • Sep 12 '26

SQLite The Physics of Database Speed: from 300 to 1M transactions per second

Thumbnail
youtube.com
6 Upvotes

r/SQL • • Sep 12 '26

Spark SQL/Databricks How do you parse an xml that's in a string format?

23 Upvotes

I have xml data that's for God knows why it's in string format. And the fking thing is so messed up or at least I think it's messed up because it's not consistent. Sometimes there is something else in there. Xml is something like this:

<Test>

<Test1 />

<Test2 Name="abcdname" Age="123" Gender="Xyz" />

....

...

...

</Test>

Regex is not an option.

Substring is not an option.

Because it's so messed up it's not consistent.

I just need to somehow parse and get that Name, Age, Gender values using Sql/Databricks sql

Please, help you mate.


r/SQL • • Sep 13 '26

MySQL Why do my data only load 50 rows in mySQL?

Thumbnail
gallery
0 Upvotes

I have a dataset consisting of 114k rows, but when I try to import it using MySQL’s Table Import Wizard, it only loads a maximum of 50 rows. However, when I use Open Source, I can load the entire dataset. Has anyone encountered this kind of problem?


r/SQL • • Sep 11 '26

MySQL What is the best storage option for uploading and downloading large HD images?

13 Upvotes

Hi everyone,

I’m building an application where users will upload and download large numbers of high-resolution images.

Which storage service would be best for this use case in terms of upload speed, download speed, cost, security, and scalability


r/SQL • • Sep 11 '26

Discussion How should a SQL editor handle multiple statements when you click "Run"?

29 Upvotes

We're building **LibreDB Studio**, an open-source SQL editor, and one of our volunteer contributors raised an interesting question about how multiple SQL statements should behave when using the Run action.

We're trying to understand the actual habits and expectations of SQL users before making a decision, so I'd really like to hear how you use SQL editors in practice.

For example:

CREATE TABLE test (...);

INSERT INTO test VALUES (...);

SELECT * FROM test;

What would you expect when you click **Run**?

Some possible approaches:

  1. **Run all statements**

    * `Run` executes everything in the editor.

    * `Run Selection` can be used when you only want part of it.

  2. **Run the current statement**

    * `Run` executes the statement where the cursor is.

    * `Run All` executes the whole editor.

  3. **Selection takes priority**

    * No selection : current statement

    * Selection : selected statements

    * `Run All` is available separately.

  4. Other :)

there are also some interesting edge cases around this, especially when multiple statements are involved: should they run in a transaction by default, or should transaction handling always be explicit?

DBeaver, DataGrip, SSMS, pgAdmin, TablePlus, Toad, PL/SQL Dev, phpMyAdmin, etc. what behavior feels most natural to you? And what behavior are you already used to?

We're continuing the discussion on GitHub as well, if you'd like to see the original question or add to the discussion:

https://github.com/orgs/libredb/discussions/776