Tagged articles
35 articles
Page 1 of 1
ITPUB
ITPUB
May 23, 2025 · Databases

Why Storing 2 Billion Phone Numbers Requires VARCHAR(20) Over INT/BIGINT

When designing a database for billions of phone numbers, using INT or BIGINT leads to overflow, data‑integrity loss, and inefficient queries, while VARCHAR(20) preserves formatting, supports international extensions, simplifies validation, and avoids common development pitfalls.

Database designSQLdata integrity
0 likes · 10 min read
Why Storing 2 Billion Phone Numbers Requires VARCHAR(20) Over INT/BIGINT
Architect
Architect
May 17, 2025 · Databases

Storing 2 Billion Phone Numbers: Why VARCHAR(20) Is Preferable to INT/BIGINT

The article explains why using a VARCHAR(20) column to store billions of phone numbers is safer and more flexible than INT or BIGINT, covering range limits, data integrity, query convenience, interview expectations, and common pitfalls such as insufficient field length, charset issues, missing indexes, and lack of encryption.

BIGINTSQLdata integrity
0 likes · 10 min read
Storing 2 Billion Phone Numbers: Why VARCHAR(20) Is Preferable to INT/BIGINT
Senior Brother's Insights
Senior Brother's Insights
May 13, 2025 · Databases

Debunking MySQL VARCHAR Myths: Why 255 Isn’t the Magic Number

This article examines common misconceptions about MySQL VARCHAR—why 255 was historically used, the real maximum length, performance differences between short and long definitions, character‑set impacts on storage, and why aligning sizes to powers of two offers no real benefit.

character encodingmysqlperformance
0 likes · 13 min read
Debunking MySQL VARCHAR Myths: Why 255 Isn’t the Magic Number
Java Tech Enthusiast
Java Tech Enthusiast
Apr 30, 2025 · Databases

Storing 2 Billion Phone Numbers: Int vs String, Schema Design and Pitfalls

When designing a schema for two‑billion phone numbers, use a VARCHAR(20) column with utf8mb4 Unicode, a unique index, and proper validation/encryption rather than a 32‑bit INT, because strings preserve leading zeros, international prefixes, extensions, and support business extensibility, fault tolerance, and future changes.

BIGINTDatabase designSQL
1 likes · 7 min read
Storing 2 Billion Phone Numbers: Int vs String, Schema Design and Pitfalls
macrozheng
macrozheng
Jan 22, 2025 · Databases

Do Varchar Lengths Really Impact MySQL Storage and Query Performance?

This article experimentally investigates whether the length of VARCHAR columns (e.g., 50 vs 500) affects MySQL storage size and query performance, covering table creation, bulk data insertion, storage queries, index and full‑table scans, and explains the underlying reasons for any differences observed.

Database designindexmysql
0 likes · 10 min read
Do Varchar Lengths Really Impact MySQL Storage and Query Performance?
Liangxu Linux
Liangxu Linux
Jan 11, 2025 · Databases

Does VARCHAR Length Really Impact MySQL Storage and Query Performance?

This article investigates whether the length of VARCHAR columns in MySQL affects both the physical storage size of tables and the execution speed of various queries, revealing that storage remains unchanged while long VARCHARs can dramatically slow down full‑table sorts.

Sortingindexmysql
0 likes · 10 min read
Does VARCHAR Length Really Impact MySQL Storage and Query Performance?
Architecture Digest
Architecture Digest
Dec 15, 2024 · Databases

Impact of VARCHAR Length on MySQL Storage and Query Performance

This article investigates whether the declared length of VARCHAR columns (e.g., VARCHAR(50) vs VARCHAR(500)) affects MySQL storage size and query performance by creating two tables, inserting one million rows, measuring disk usage, and benchmarking various SELECT and ORDER BY operations.

indexmysqlperformance
0 likes · 10 min read
Impact of VARCHAR Length on MySQL Storage and Query Performance
Java Tech Enthusiast
Java Tech Enthusiast
Dec 13, 2024 · Databases

Impact of VARCHAR Length on MySQL Storage and Query Performance

Testing shows that VARCHAR(50) and VARCHAR(500) occupy identical storage, yet while simple lookups perform similarly, sorting on the longer column triggers disk‑based mergesort and can be several times slower, demonstrating that excessive VARCHAR length harms query performance without saving space.

SQLindexmysql
0 likes · 10 min read
Impact of VARCHAR Length on MySQL Storage and Query Performance
Java Architect Essentials
Java Architect Essentials
Oct 23, 2024 · Databases

Does Varchar Length Really Affect MySQL Storage and Performance?

This article investigates whether MySQL varchar column length influences storage size and query performance by creating two tables with varchar(50) and varchar(500), inserting one million rows, measuring disk usage, and benchmarking various queries, ultimately revealing that storage is identical while longer columns can degrade performance during sorted scans due to increased temporary file usage.

Database designindexmysql
0 likes · 10 min read
Does Varchar Length Really Affect MySQL Storage and Performance?
ITPUB
ITPUB
Sep 15, 2024 · Databases

Does Varchar Length Affect MySQL Storage and Query Performance? A Practical Test

This article investigates whether defining a VARCHAR column with a larger length (e.g., VARCHAR(500) vs VARCHAR(50)) changes storage consumption and query speed in MySQL by creating two identical tables, inserting one million rows, measuring space usage, and benchmarking various SELECT and ORDER BY operations.

SQLmysqlperformance
0 likes · 10 min read
Does Varchar Length Affect MySQL Storage and Query Performance? A Practical Test
Aikesheng Open Source Community
Aikesheng Open Source Community
May 7, 2024 · Databases

Why Expanding a MySQL VARCHAR Column from 63 to 64 Characters Takes Much Longer

The article investigates why altering a MySQL VARCHAR column from a length that fits within 255 bytes to one that exceeds this limit (e.g., VARCHAR(63) to VARCHAR(64) in utf8mb4) triggers a costly copy operation, analyzes the storage mechanics, reproduces the issue, and provides practical recommendations to avoid performance penalties.

Character SetDatabase AdministrationOnline DDL
0 likes · 13 min read
Why Expanding a MySQL VARCHAR Column from 63 to 64 Characters Takes Much Longer
Aikesheng Open Source Community
Aikesheng Open Source Community
Jan 30, 2024 · Databases

Troubleshooting VARCHAR Column Expansion Issues with MySQL Online DDL

This article analyzes why ALTER TABLE operations that extend VARCHAR columns sometimes fail in MySQL, explains the underlying Online DDL constraints, presents several real‑world problems such as default‑value handling, indexed columns, and hidden table‑rebuild quirks, and offers practical solutions for each case.

ALTER TABLEDatabase AdministrationOnline DDL
0 likes · 17 min read
Troubleshooting VARCHAR Column Expansion Issues with MySQL Online DDL
IT Services Circle
IT Services Circle
May 29, 2023 · Databases

Storing IPv4 Addresses in MySQL: Choosing the Optimal Data Type

The article explains why storing IPv4 addresses as VARCHAR is suboptimal, demonstrates that a 32‑bit unsigned INT perfectly fits an IPv4 address, compares storage size and query performance, and shows how to use MySQL's inet_aton and inet_ntoa conversion functions.

IP addressdata typeinteger
0 likes · 6 min read
Storing IPv4 Addresses in MySQL: Choosing the Optimal Data Type
Liangxu Linux
Liangxu Linux
Dec 5, 2022 · Databases

How Does MySQL Store a Row? Inside InnoDB Files, Pages, and Row Formats

This article explains where MySQL keeps its data files, how InnoDB organizes tablespaces into segments, extents, pages and rows, details the Compact row format—including variable‑length field length lists, NULL‑value lists, and hidden fields—and clarifies the limits of VARCHAR and row‑overflow handling.

Database StorageExtentInnoDB
0 likes · 22 min read
How Does MySQL Store a Row? Inside InnoDB Files, Pages, and Row Formats
Top Architect
Top Architect
Sep 19, 2021 · Databases

Why Store IPv4 Addresses as UNSIGNED INT in MySQL Instead of VARCHAR

The article explains that using a 32‑bit UNSIGNED INT to store IPv4 addresses in MySQL saves space, improves index and range‑query performance, and provides built‑in conversion functions, while also noting readability drawbacks and offering Java utilities for manual conversion.

INET_ATONIP address storageJava
0 likes · 6 min read
Why Store IPv4 Addresses as UNSIGNED INT in MySQL Instead of VARCHAR
Top Architect
Top Architect
Jul 5, 2021 · Databases

MySQL Implicit Type Conversion Leads to Unexpected Query Results

This article explains how MySQL implicitly converts mismatched column types—such as comparing a VARCHAR column with a numeric literal—into floating‑point numbers, causing seemingly equal values to match, losing index usage, and potentially producing incorrect query results.

Implicit ConversionIndex Usagefloating-point
0 likes · 7 min read
MySQL Implicit Type Conversion Leads to Unexpected Query Results
Aikesheng Open Source Community
Aikesheng Open Source Community
Dec 8, 2020 · Databases

Understanding MySQL Online DDL for VARCHAR Column Size Changes and In‑Place vs Copy Operations

The article explains how MySQL's Online DDL handles VARCHAR column expansions, demonstrates performance differences across character sets using sysbench, and clarifies why certain size changes trigger in‑place alterations while others require full table copies, providing practical guidance for DBAs.

Character SetInnoDBOnline DDL
0 likes · 9 min read
Understanding MySQL Online DDL for VARCHAR Column Size Changes and In‑Place vs Copy Operations
Java High-Performance Architecture
Java High-Performance Architecture
Jul 3, 2015 · Databases

When to Use CHAR vs VARCHAR in MySQL? Understanding Length, Storage, and Performance

CHAR stores fixed‑length strings padded with spaces, while VARCHAR stores variable‑length strings with a length byte, leading to different maximum sizes—255 characters for CHAR and up to 65,535 bytes for VARCHAR (about 21,589 UTF‑8 characters)—and distinct use cases such as short fixed fields versus space‑saving flexible fields.

Database designcharmysql
0 likes · 2 min read
When to Use CHAR vs VARCHAR in MySQL? Understanding Length, Storage, and Performance