Showing posts with label bit. Show all posts
Showing posts with label bit. Show all posts

Wednesday, March 28, 2012

How much storage needed for bit datatypes?

Hi!

I'm investigating if it is an good idea to use some form of "bitmap index",

e.g. I have an normal table with 100-200 columns, but sometimes I just want to know:

"Is there an value in the cell" (...where col20 is not null)

So I will measure if I get some benifit, so If you tried this, let me hear, but otherwise see only the rest:

If I remember correctly SQL Server will group bit-columns in some way minimizing storage needs,

but my questions: how much storage is needed for an bit column:

1 or 2 bit (the second bit, because we can have three states: 0,1 and null)

Will 8 bit-columns need 1 byte or 2 byte?

I tried some tests with a number table (1mio rows), but It didn't give me the answer.

Best Regards

Bjorn

create table tmpbit (a bit)

create table tmpbit8 (a1 bit, a2 bit, a3 bit , a4 bit, a5 bit , a6 bit, a7 bit, a8 bit)

insert into tmpbit

select cast(1 as bit) from numbers

insert into tmpbit8

select cast(1 as bit) , cast(1 as bit) , cast(1 as bit) , cast(1 as bit) ,

cast(1 as bit) , cast(1 as bit) , cast(1 as bit) , cast(1 as bit)

from numbers

select object_id('tmpbit8') -- for input to dbcc

DBCC SHOWCONTIG scanning 'tmpbit' table...

Table: 'tmpbit' (1269891891); index ID: 0, database ID: 6

TABLE level scan performed.

- Pages Scanned................................: 1359

- Extents Scanned..............................: 171

- Extent Switches..............................: 170

- Avg. Pages per Extent........................: 7.9

- Scan Density [Best Count:Actual Count].......: 99.42% [170:171]

- Extent Scan Fragmentation ...................: 1.75%

- Avg. Bytes Free per Page.....................: 1.8

- Avg. Page Density (full).....................: 99.98%

DBCC SHOWCONTIG scanning 'tmpbit8' table...

Table: 'tmpbit8' (1301892005); index ID: 0, database ID: 6

TABLE level scan performed.

- Pages Scanned................................: 1359

- Extents Scanned..............................: 171

- Extent Switches..............................: 170

- Avg. Pages per Extent........................: 7.9

- Scan Density [Best Count:Actual Count].......: 99.42% [170:171]

- Extent Scan Fragmentation ...................: 0.58%

- Avg. Bytes Free per Page.....................: 1.8

- Avg. Page Density (full).....................: 99.98%

both tmp-tables uses 10,617 MB

If your table have 1-8 then the values are strored in 1 Byte. again 1-16 stored in 2 bytes...

ie,

CEILING(n number of BIT columns /8.0) Bytes will be occupied.

|||

Hi!

Yes, but how can db store null without using extra bit?

/Bjorn

|||It can't. In fact, the null bitmap is an entirely separate structure within the row. Inside Microsoft SQL Server 2005: The Storage Engine (Delaney) has a nice diagram on page 216, along with some explanations, but the main details are that the null bitmap lies after the fixed-length column data, but before the variable-length column data. Furthermore, in SQL Server 2005, a row always has a null bitmap, even if there are no nullable columns. The size of the bitmap is 1 byte per 8 columns, rounded up to the nearest byte.

Monday, March 26, 2012

How much of memory is too much for SQL on 64 bit

We want to move to a 64 bit platform .
First of all I would like to know if there are any cons w/ 64 bit. I would
consider moving to SQL 2005
And second, how much of RAM do you use on such systems ? I dont want to buy
a lot. Would 32 GB or 64 GB be a good start ?Hi
As far as performance you can only really tell if you have enough memory if
you benchmark the application. As this is an existing platform you may want
to take the current amount as a guide if you are not having problems with the
current level of memory, but make sure that you allow for expansion and don't
use up all the available slots (you may want to use a few slots as you can!)
Make sure that you buy as system that satisfies the 64 bit requirements in
http://www.microsoft.com/sql/editions/enterprise/sysreqs.mspx
You should analyse you current design and make sure that you are not limited
by other factors such as hard disc capacity or performance. Make sure that
you buy a sufficiently flexible system so that you can place your database
files in such a way that it will maximise I/O as well have sufficient
capacity for future expansion. Also make sure that you have sufficient
spindles to separate tempdb, the system databases, OS and pagefile etc.
John
"Hassan" wrote:
> We want to move to a 64 bit platform .
> First of all I would like to know if there are any cons w/ 64 bit. I would
> consider moving to SQL 2005
> And second, how much of RAM do you use on such systems ? I dont want to buy
> a lot. Would 32 GB or 64 GB be a good start ?
>
>
>

How much of memory is too much for SQL on 64 bit

We want to move to a 64 bit platform .
First of all I would like to know if there are any cons w/ 64 bit. I would
consider moving to SQL 2005
And second, how much of RAM do you use on such systems ? I dont want to buy
a lot. Would 32 GB or 64 GB be a good start ?Hi
As far as performance you can only really tell if you have enough memory if
you benchmark the application. As this is an existing platform you may want
to take the current amount as a guide if you are not having problems with th
e
current level of memory, but make sure that you allow for expansion and don'
t
use up all the available slots (you may want to use a few slots as you can!)
Make sure that you buy as system that satisfies the 64 bit requirements in
http://www.microsoft.com/sql/editio...se/sysreqs.mspx
You should analyse you current design and make sure that you are not limited
by other factors such as hard disc capacity or performance. Make sure that
you buy a sufficiently flexible system so that you can place your database
files in such a way that it will maximise I/O as well have sufficient
capacity for future expansion. Also make sure that you have sufficient
spindles to separate tempdb, the system databases, OS and pagefile etc.
John
"Hassan" wrote:

> We want to move to a 64 bit platform .
> First of all I would like to know if there are any cons w/ 64 bit. I would
> consider moving to SQL 2005
> And second, how much of RAM do you use on such systems ? I dont want to bu
y
> a lot. Would 32 GB or 64 GB be a good start ?
>
>
>

Monday, March 19, 2012

How many concurrent users does MSDE 2000 support?

I am a little bit confused about this issue. The MSDE 2000 tech notes tells about a limit of 5 workloads. Does it means 5 concurrent users? How many concurrent users can be connected in a single database? Can I have more than 5 users on client applicatio
ns whithout degradation ?
> limit of 5 workloads. Does it means 5 concurrent users?
No, it means 5 users performing work at the exact same time. You can have a
boatload of idle connections, but if they all start doing work, you're
eventually going to see the governor start to throttle performance.

> How many concurrent users can be connected in a single database?
How fast can your car go? Depends on plenty of things: weather, road
conditions, speed limit, presence of state troopers, tire pressure, your own
nerves, abilities, reflexes, etc. etc. Impossible to answer for you, you
will need to test it yourself.
How many users can be connected to a database? Depends on plenty of things:
application code, what they're actually doing, hardware, bandwidth, what
else the server is spending resources on, disk I/O, etc. etc. Impossible to
answer for you, you will need to test it yourself.

> Can I have more than 5 users on client applications whithout degradation ?
Possibly. See above.
http://www.aspfaq.com/
(Reverse address to reply.)
|||In addition to Aaron's information, have a look at these topics in the
lastest version of the SQL Server 2000 Books Online:
http://msdn.microsoft.com/library/de...asp?frame=true
http://msdn.microsoft.com/library/de...asp?frame=true
http://msdn.microsoft.com/library/de...asp?frame=true
http://msdn.microsoft.com/library/de...asp?frame=true
Alan Brewer [MSFT]
Lead Programming Writer
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights

How many columns is ok?

Hello!

I have a database table containing about 40 columns, mostly bit data type, some nvarchar and smallint columns...

Is it ok to have so many columns in one table and how does the number of columns affect database perfomance? Wouldn't it be better to split this table?

Thank You!
JannoPossible? Yes. OK. Not really.

My guess is that you need to work on normalizing your database. For example, all those bit datatypes might be better served off in their own table, with a vertical not horizontal, design. This would much more easily allow you to add traits (bits) in the future.

What is the nature of the table, and what is being stored in all of those BIT columns?|||Pjmcb,

Basically it's a databese for flat rental site. Those BIT columns are used to store True/False type values.

In case I'm going to store those values verticaly in a separate table... could you please explain me how does it exactly works - I'm a SQL Server newbie...

Ads Table structure:
------------
AdIDint
AdTypesmallint
UserIDnvarchar
Activebit

AdDetails Table structure:
------------
AdIDint
Areasmallint
StreetNamenvarchar
Neighbourhoodnvarchar
Citynvarchar50
PostCodenvarchar15
AvailableFromdatetime
Rentmoney8
MinimumStaysmallint
Depositmoney8
PropertyTypenvarchar
Floorsmallint2
Parkingbit1
AdditionalCostmoney
Bathroomssmallint2
Bedroomssmallint2
Gasbit1
Cablebit1
TVbit1
Phonebit1
Closetbit1
Furnishedbit1
AirConditioningbit1
Bathbit1
Fireplacebit1
Balconybit1
Elevatorbit1
Washerbit1
KitchenAccessbit1
Storagebit1
Gardenbit1
Poolbit1
Gymnbit1|||You might have a second table, and call it, say Traits.

In this table, you might include each of the bit traits, along with an ID for each trait.

Then, you could have a join table to link each particular trait with each type of apartment. You would only have records in the join table for those traits that applied to a specific apartment.

You might have a second table for manetary items, with a similar join table, and a third with rooms or similar information.

With your join tables for these last two items, you could include additional information. For example, you might have:

Rooms
--
RoomID
RoomName
RoomDesc

(which might contain: Bedroom; Bathroom; Closets; Laundry Room; Kitchen; Living Room)

AdRooms
--
AdID
RoomID
RoomCount

Obviously, I'm throwing this out off the top of my head. But when you need to run an ad featuring an apartment with a SunRoom, all you need to do is add a record to your Rooms, table, and assign that value to your new apartment. You don't have to go in and change your database design.

Your retrieval of data might be a bit more complicated (actually, I would argue that ultimately, once you get comfortable with SQL, it will be easier), but growing the application will be much easier.|||I completely agree in principle with normalizing this, but it does depend on how the data is being used. if every single ad always lists each of those categories with a yes/no, it may make sense to leave it denormalized. bits don't hurt you that much as far as performance, the table is still relatively narrow. normalizing does make maintenance much better, as you point out, when you want to add additional attributes. it also makes the query more complex, although not necessarily slower. so those are just some tradeoffs I would keep in mind.

cs

How many 64 bit architectures are out there ?

I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
same as x64? Can someone tell me what else is out there and differences
between those ?
Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
IA64 called ?
I take it that SQL 20005 only has its bits on IA64 and x64 right ?There are only two 64 bit architectures supported by SQL Server (and
actually driven by the supported 64-bit architectures for Windows). The
separation is based on the underlying processor architecture.
The first one is IA-64 (or Itanium) and it is based on the EPIC (Explicitly
Parallel Instruction Computing) instruction set. This is Intel's first true
64-bit chip.
The second 64 bit architecture is x64 (or x86-64) which is essentially the
x86 architecture with extensions to include 64 bit functionality. All Intel
x64 and AMD64 processors fall in this category. It was first introduced with
AMD's Athlon 64.
There is no 32 bit equivalent for IA-64 as it was designed to be 64 bit from
the beginning.
It is more correct to say x86-32 for the 32-bit equivalent, as x86 is the
generic name for the architecture which started with Intel's 8086 processor
which was 16-bit. The x86-32 was introduced with the Intel 386 processor.
See more details on 64-bit computing with SQL Server 2005 here:
http://www.microsoft.com/sql/editio...t/overview.mspx
Regards,
Plamen Ratchev
http://www.SQLStudio.com
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>|||To add on to Plamen's response, AMD64 (AMD) and EMT64 (Intel) are basically
vendor-specific names for x64.
Hope this helps.
Dan Guzman
SQL Server MVP
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>|||In addition, read this http://en.wikipedia.org/wiki/X64
Linchi
"Hassan" wrote:

> I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
> same as x64? Can someone tell me what else is out there and differences
> between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>
>

How many 64 bit architectures are out there ?

I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
same as x64? Can someone tell me what else is out there and differences
between those ?
Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
IA64 called ?
I take it that SQL 20005 only has its bits on IA64 and x64 right ?
There are only two 64 bit architectures supported by SQL Server (and
actually driven by the supported 64-bit architectures for Windows). The
separation is based on the underlying processor architecture.
The first one is IA-64 (or Itanium) and it is based on the EPIC (Explicitly
Parallel Instruction Computing) instruction set. This is Intel's first true
64-bit chip.
The second 64 bit architecture is x64 (or x86-64) which is essentially the
x86 architecture with extensions to include 64 bit functionality. All Intel
x64 and AMD64 processors fall in this category. It was first introduced with
AMD's Athlon 64.
There is no 32 bit equivalent for IA-64 as it was designed to be 64 bit from
the beginning.
It is more correct to say x86-32 for the 32-bit equivalent, as x86 is the
generic name for the architecture which started with Intel's 8086 processor
which was 16-bit. The x86-32 was introduced with the Intel 386 processor.
See more details on 64-bit computing with SQL Server 2005 here:
http://www.microsoft.com/sql/editions/64bit/overview.mspx
Regards,
Plamen Ratchev
http://www.SQLStudio.com
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>
|||To add on to Plamen's response, AMD64 (AMD) and EMT64 (Intel) are basically
vendor-specific names for x64.
Hope this helps.
Dan Guzman
SQL Server MVP
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>
|||In addition, read this http://en.wikipedia.org/wiki/X64
Linchi
"Hassan" wrote:

> I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
> same as x64? Can someone tell me what else is out there and differences
> between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>
>

How many 64 bit architectures are out there ?

I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
same as x64? Can someone tell me what else is out there and differences
between those ?
Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
IA64 called ?
I take it that SQL 20005 only has its bits on IA64 and x64 right ?There are only two 64 bit architectures supported by SQL Server (and
actually driven by the supported 64-bit architectures for Windows). The
separation is based on the underlying processor architecture.
The first one is IA-64 (or Itanium) and it is based on the EPIC (Explicitly
Parallel Instruction Computing) instruction set. This is Intel's first true
64-bit chip.
The second 64 bit architecture is x64 (or x86-64) which is essentially the
x86 architecture with extensions to include 64 bit functionality. All Intel
x64 and AMD64 processors fall in this category. It was first introduced with
AMD's Athlon 64.
There is no 32 bit equivalent for IA-64 as it was designed to be 64 bit from
the beginning.
It is more correct to say x86-32 for the 32-bit equivalent, as x86 is the
generic name for the architecture which started with Intel's 8086 processor
which was 16-bit. The x86-32 was introduced with the Intel 386 processor.
See more details on 64-bit computing with SQL Server 2005 here:
http://www.microsoft.com/sql/editions/64bit/overview.mspx
Regards,
Plamen Ratchev
http://www.SQLStudio.com
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>|||To add on to Plamen's response, AMD64 (AMD) and EMT64 (Intel) are basically
vendor-specific names for x64.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Hassan" <Hassan@.hotmail.com> wrote in message
news:O39B4jtLHHA.1044@.TK2MSFTNGP02.phx.gbl...
>I have heard of IA64 bit and x64 bit ? Is there an AMD64 as well or is the
>same as x64? Can someone tell me what else is out there and differences
>between those ?
> Is x86 a 32 bit equivalent of x64 ? If so whats the 32 bit eqiivalent to
> IA64 called ?
> I take it that SQL 20005 only has its bits on IA64 and x64 right ?
>

Friday, March 9, 2012

HOW LINKED DbASE FOLDER TO SQL 2005 64 BIT? PLEASE HELP ME!!

I HAVE SQL2005 32 BIT ( TEST) AND SECOND MACHINE 64 BIt
(PRODUCTION).
IN 32 BIT I LINKED SUCCESFULL DBASE FOLDER (FILES CLIPPER) BY
OPENROWSET BY:
select * from OPENROWSET('MSDASQL',
'Driver={Microsoft dBase Driver};SourceDB=c:\MyApp\;SourceType=dbf',
'select * from MyTable')
IN 64 bit SQL2k5 I have message :
"MSDASQL provider not regisetered"
IN SQL MANAGER registration 'MSDASQL' provider is impossible?.
Do YOU HAVE INFORMATION , HOW LINKED DBASE FOLDER TO SQL2005 64
BIT ?
PLEASE HELP ME
You cannot use a 32 bit ODBC driver from SQL-2005 64 bit; you can only use
64 bit drivers. Unless you find a 64 bit driver for dBase, you cannot open
your dBase folder directly from SQL-2005 64 bit.
For a possible solution, see:
http://gorm-braarvig.blogspot.com/2005/11/access-database-from-sql-200564.html
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
<gramir@.lanet.wroc.net> wrote in message
news:1174123698.892870.223050@.p15g2000hsd.googlegr oups.com...
>I HAVE SQL2005 32 BIT ( TEST) AND SECOND MACHINE 64 BIt
> (PRODUCTION).
> IN 32 BIT I LINKED SUCCESFULL DBASE FOLDER (FILES CLIPPER) BY
> OPENROWSET BY:
> select * from OPENROWSET('MSDASQL',
> 'Driver={Microsoft dBase Driver};SourceDB=c:\MyApp\;SourceType=dbf',
> 'select * from MyTable')
> --
> IN 64 bit SQL2k5 I have message :
> "MSDASQL provider not regisetered"
> IN SQL MANAGER registration 'MSDASQL' provider is impossible?.
> Do YOU HAVE INFORMATION , HOW LINKED DBASE FOLDER TO SQL2005 64
> BIT ?
> PLEASE HELP ME
>

HOW LINKED DbASE FOLDER TO SQL 2005 64 BIT? PLEASE HELP ME

I HAVE SQL2005 32 BIT ( TEST) AND SECOND MACHINE 64 BIt
(PRODUCTION).
IN 32 BIT I LINKED SUCCESFULL DBASE FOLDER (FILES CLIPPER) BY
OPENROWSET BY:
select * from OPENROWSET('MSDASQL',
'Driver={Microsoft dBase Driver};SourceDB=c:\MyApp\;SourceType=db
f',
'select * from MyTable')
IN 64 bit SQL2k5 I have message :
"MSDASQL provider not regisetered"
IN SQL MANAGER registration 'MSDASQL' provider is impossible?.
Do YOU HAVE INFORMATION , HOW LINKED DBASE FOLDER TO SQL2005 64
BIT '
PLEASE HELP MEYou cannot use a 32 bit ODBC driver from SQL-2005 64 bit; you can only use
64 bit drivers. Unless you find a 64 bit driver for dBase, you cannot open
your dBase folder directly from SQL-2005 64 bit.
For a possible solution, see:
[url]http://gorm-braarvig.blogspot.com/2005/11/access-database-from-sql-200564.html[/ur
l]
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
<gramir@.lanet.wroc.net> wrote in message
news:1174123698.892870.223050@.p15g2000hsd.googlegroups.com...
>I HAVE SQL2005 32 BIT ( TEST) AND SECOND MACHINE 64 BIt
> (PRODUCTION).
> IN 32 BIT I LINKED SUCCESFULL DBASE FOLDER (FILES CLIPPER) BY
> OPENROWSET BY:
> select * from OPENROWSET('MSDASQL',
> 'Driver={Microsoft dBase Driver};SourceDB=c:\MyApp\;SourceType=db
f',
> 'select * from MyTable')
> --
> IN 64 bit SQL2k5 I have message :
> "MSDASQL provider not regisetered"
> IN SQL MANAGER registration 'MSDASQL' provider is impossible?.
> Do YOU HAVE INFORMATION , HOW LINKED DBASE FOLDER TO SQL2005 64
> BIT '
> PLEASE HELP ME
>