Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3696206
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:42:39+00:00 2026-05-19T04:42:39+00:00

Does the order of the column types in your database have any affect on

  • 0

Does the order of the column types in your database have any affect on the query time?

For example, would a table with mixed ordering (INT, TEXT, VARCHAR, INT, TEXT) be slower to query than a table with consecutive types (INT, INT, VARCHAR, TEXT, TEXT)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:42:40+00:00Added an answer on May 19, 2026 at 4:42 am

    The answer is yes, it does matter, and it can matter a great deal, but usually not much.

    All I/O is done at a page level (typically 2K or 4K depending on your OS). Column data for rows are stored next to each other, except when the page becomes full, in which case the data is written on the another (usually the next) page.

    The greater the on-disk data space required for columns between (based on the the table definition) the columns you select, the greater the chance that the data for the selected columns will (sometimes) be on different pages. Being on a different page may result in an extra I/O operation (if there are no other rows being selected on the other page). In the worst case, each column you select could be on a different page.

    Here’s an example:

    create table bad_layout (
    num1 int,
    large1 varchar(4000),
    num2 int,
    large2 varchar(4000),
    num3 int,
    large3 varchar(4000)
    );
    
    create table better_layout (
    num1 int,
    num2 int,
    num3 int,
    large1 varchar(4000),
    large2 varchar(4000),
    large3 varchar(4000)
    );
    

    Comparing:
    select num1, num2, num3 from bad_layout;
    select num1, num2, num3 from better_layout;

    Because for bad_layout each num column is basically going to be on a different page, each row will require 3 i/O operations. Conversely, for better_layout num columns are usually going to be on the same page.

    The bad_layout query is likely to take about 3 times longer to execute.

    Good table layout can make a large difference to query performance. You should try to keep columns that are usually selected together as close as possible to each other in the table layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In SQL Server 2005, I have a query that involves a bunch of large-ish
I just dowloaded the Google IO Source code from here: http://code.google.com/p/iosched/ in order to
I have two xsl file each for different type of machines for various unix
I have a process that imports a daily file of product registrations, and adds
I need to combine a folder full of pdfs into one file. However they
consider the following test class: [TestClass] public class ExampleTests { [TestMethod] public void FileDoesNotExists()
I'm planning on building a file cataloging system. It will do something very similar
Hi I'm trying to implement a bluetooth library and in it I want to
I am running a simulation on financial data which fires off this stored procedure
Suppose in the current directory there is a file named somecode.py , and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.