Datetime d = Convert. todatetime (system. datetime. Now. tostring ( " Yyyy-mm-dd " ));
LongLongbegin=D. ticks;
LongLongend=D. adddays (1). Addmilliseconds (-1). Ticks;
String SQL = " Select * from TB where tricksfield between @ loginbegin and @ lengend " ;
Sqlcommand cmd = New Sqlcommand ();
Cmd. Parameters. Add ( " @ Loginbegin " , Dbtype. int64, 64 );
Cmd. Parameters. Add ( " @ Loginend " , Dbtype. int64, 64 );
Cmd. Parameters [ 0 ]. Value = Longbegin;
Cmd. Parameters [ 1 ]. Value = Longend;
Find a million-level data table on the birthday of today,
Two parameters can be generated in C # and executed in a stored procedure or by passing a parameter statement. indexes can be created on ticksfield to Improve the efficiency.
//************************************** *
. NET Framework class library
Datetime. ticks attribute
The value of this attribute indicates that the time passed since midnight, January 1, January 1, 0001 is 100 milliseconds.
The number of intervals.
If SQL is used, use the front-endProgramObtain several data records.
C # code datetime d = convert. todatetime ("1900-1-1 ");
Datetime d1 = convert. todatetime ("0001-1-1 ");
Timespan T = D-D1;
Response. Write ("1900-1-1. ticks:" + D. ticks + "</BR> ");
Response. Write ("0001-1-1. ticks:" + d1.ticks + "</BR> ");
Response. Write (T. totalmilliseconds. tostring ());
First, create the logical model of the table structure:
Use the data warehouse modeling idea to create a star model:
1 fact table
Id Primary Key
Crrq_id date ID
Place_id location ID
Xname_id name ID
XX fact Field
2. Date dimension table
Crrq_id date ID
Crrq date
3. Location dimension table
Place_id location ID
Place location
4. Customer dimension table
Xname_id name ID
Xname
Using the physical Optimization Method of the DB2 database:
Fact tables
1. database partition
2 Table partitions
3. Create an MDC
4. Create an MQT
5. Create a bitmap index for the federated primary key
A table with 0.4 billion data entries can only be regarded as a small table in the data warehouse.