sqlschool.gr logo

articles

Articles of SQLschool.gr Team

Why you must choose correctly the size of each field in a table

Antonios Chatzipavlis
Tuesday 25 April 2017

Κάθε φορά κατά την διάρκεια ενός μαθήματος ή μιας παρουσίασης που κάνω με θέμα το σχεδιασμό μιας database και των tables αυτής όταν επίμονα τονίζω ότι πρέπει να επιλέγουμε με πραγματικά κριτήρια το μέγεθος κάθε field που θα βάλουμε στο table και όχι με την λογική βάλε κάτι μεγάλο γιατί δεν ξέρεις τι θα γίνει στο μέλλον, με κοιτάνε αρκετοί περίεργα.

Με κοιτάνε περίεργα γιατί απλά βλέπουν μόνο το field αλλά δεν βλέπουν το scaling της database.

Για να το πως λοιπόν όσο απλούστερα γίνεται.

Έστω ότι σε ένα πεδίο βάζω 1 byte λιγότερο γιατί πραγματικά είδα ότι δεν μου χρειάζεται τότε σε ένα πίνακα με 1.000.000 εγγραφές κερδίζω 1 ΜΒ τόσο σε χώρο στο δίσκο όσο και στην μνήμη της buffer cache.

Με την ίδια λογική δείτε το παρακάτω πίνακα και αποφασίστε μόνοι σας για το αν πρέπει να δαπανήσετε μυαλό και χρόνο σε κάτι τέτοιο.

Bytes Saved per Row Number of Rows in Table MB saved in Table/Database
1 1.000.000 1
1 10.000.000 10
1 100.000.000 95
1 1.000.000.000 954
8 1.000.000 8
8 10.000.000 76
8 100.000.000 763
8 1.000.000.000 7.629
16 1.000.000 15
16 10.000.000 153
16 100.000.000 1.526
16 1.000.000.000 15.259
32 1.000.000 31
32 10.000.000 305
32 100.000.000 3.052
32 1.000.000.000 30.518
64 1.000.000 61
64 10.000.000 610
64 100.000.000 6.104
64 1.000.000.000 61.035


//antonch

Antonios Chatzipavlis

Antonios Chatzipavlis

Antonios Chatzipavlis is a highly experienced Data Solutions Consultant and Trainer. He has been working in the IT industry since 1988, holding various roles such as senior developer, IT Manager, Data & AI Solutions Architect and Consultant.

Since 1995, Antonios has focused on modern technologies and software development tools, primarily by Microsoft. He has specialized in Data & AI since 2000, with expertise in Microsoft Data Platform (SQL Server, Azure SQL Databases, Azure Synapse Analytics, Microsoft Fabric, Power BI, AI) and Databricks.

Antonios is also a Microsoft Certified Trainer (MCT) for over 25 years, has been recognized as a Microsoft Most Valuable Professional (MVP) in Data Platform since 2010 and he is in the Data Expert 40 Powerlist 2024 by Boussias. He is the co-founder and visionary behind XLYTiCA, a company dedicated to Data & AI solutions.

Episode

Task Flows in Microsoft Fabric

image

More Episodes...

Tip

Get Certified: Become a Fabric Data Engineer

More Tips...

Become a member

If you want to receive updates from us become a member to our community.

Connect

Explore

Learn

sqlschool.gr © 2010-2025 All rights reserved

This site uses cookies for operational and analytics purposes only. By continuing to browse this site, you agree to their use.