I have a table with 2.5 million records and I want to add a new column to it in a certain place. I would normally do this in design view in Enterprise Manager, but with my table of this many records, it takes literally 30 minutes to save a 1 byte column. When I do this with "ALTER TABLE"...
What is the rule of thumb for creating an index on a Y/N column. I have a table with 15 char(1) fields with the possible value of Y or N.
My table has 2.5 million records. I need the ability to filter by any of these columns either by Y or N and sometimes other criteria regarding other...
I appreciate everyone's help with this. I had a few unnecessary fields in the big table and the total bytes I had for the rows were at 1050. After I removed some of the columns, I got the bytes down to 550 and I can see a great improvement already in speed. I just assumed that as long as I...
So I can see if I had a table of 2-3 million records that I should move my voterhistory to another table. But should I really move my address, phone, email to separate tables as well?
Its not good practice to have Name, Address, City, State, Zip, Phone, Email in a single table??
Thanks George, that clears tings up a lot.
Christian, I'm not quite sure I understand your VoteHistory response. Each person has a field currently Gen00, Gen02, Gen04, Gen06, etc. either Y or N.
I'm not sure how to make 20 columns into 2 or 3?
Do I need a row for every possibility, then do...
Just so I understand this, a page is what's considered the table not the recordset.
ie.
T1 = 10 fields
SELECT F1 FROM T1 WHERE xzy = ?
....is faster than....
T1 = 50 fields
SELECT F1 FROM T1 WHERE xzy = ?
I just read an article that the same temp table can't be created in a sproc even if its in an if-else. I assume this is a limitation to at least SQL 2000 and before the sproc is compiled, there must be something in memory disallowing this.
I need to create a temp table in a sproc but I an getting a strange error.
---------------------------------------
CREATE PROCEDURE [dbo].[sp_UpdateTotalsAgePrecinct]
(
@fromAge as Integer, @toAge as Integer
)
AS
IF @toAge > 0
SELECT NCOACounty, NCOAPrecinct INTO #tmpPrecinctAge
FROM...
So even if my sql statement only selects a few fields, does the IO have to include everything?
ie.
Select field1, field2, field3 from <tableWith50fields>
is much faster than
Select field1, field2, field3 from <tableWith10fields>
So best to have multiple tables all with one-to-one relationship, so that you have less columns?? Even though vote history is different for every single person, put that in a different table. So my database will have say 5 tables all with 2.5 million records?
My database is normalized. Each voter has 50+ properties. How else can you normalize on that.
Age
Name
Race
Gender
VoteHistory - 20 columns which are Y/N
Addresses
Phone
Email
Districts - 10 columns...
I have a site that has voter information for a state. There are over 2.5 million records in the main table with 50 fields. This site allows users to choose many different filters to get counts. ie. Race, Age, Gender, Vote history, etc. No matter what my indexes are, it still takes anywhere...
I sometimes do a mass update in Query Analyzer.
ie. Update t1 Set f1 = 'Y' WHERE f1 = 'Yes'
If this is a very large dataset and can take 3 or 4 minutes, my web application that reads this same table can't view a single record while this update is going on.
It will timeout if I just want to...
looping thru in the app code. It could 150K records. I've defragged my indexes by the way.
Here is a simple command that take a while.
Table: Voters
Fields Querying on: Race, Gender and Age (age is an int field that I will update nightly based on Birthdate, then rerun the index on it)
SQL...
I have to loop thru the records, how else am I going to write them out to a csv file? All these tables are static, no updates are ever made. when I look at the execution plans, I see 5% here, 7% there, then 47% bookmark. I'm not quite sure if that's bad or not.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.