473,466 Members | 1,470 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

optimization question

I've got a table T with 20 columns (fixed length) and one column C
which is varchar.

Somehow C has to be varchar.

T may have millions of records.

Is there a way to optimize this situation ?

Any ideas?

Jul 23 '05 #1
5 1232
siliconmike wrote:
I've got a table T with 20 columns (fixed length) and one column C
which is varchar.

Somehow C has to be varchar.

T may have millions of records.

Is there a way to optimize this situation ?


Optimize for what task or goal? Space efficiency? Import speed? Query
speed? If query speed, what kind of queries do you need to make against
the data?

It sounds to me like someone gave you an order like, "store all these
millions of text strings in a database, and make sure it's *optimized*."
Only they didn't tell you the the criteria I ask for above.

Regards,
Bill K.
Jul 23 '05 #2
Optimize for what task or goal? Space efficiency? Import speed? Query speed? If query speed, what kind of queries do you need to make against the data?
Import speed, but without making C fixed length. For example, would
taking C to a different table help?
It sounds to me like someone gave you an order like, "store all these millions of text strings in a database, and make sure it's *optimized*." Only they didn't tell you the the criteria I ask for above.


Sounds wrong.

Jul 23 '05 #3
siliconmike wrote:
Import speed, but without making C fixed length. For example, would
taking C to a different table help?


I'd recommend using the LOAD DATA INFILE statement. The docs suggest it
can up to 20 times faster than inserting using INSERT.

LOAD DATA INFILE uses field delimiters; it does not require the input
data formatted in fixed length. See examples at
http://dev.mysql.com/doc/mysql/en/load-data.html

Also read the suggestions for speeding up inserts and LOAD DATA on this
page: http://dev.mysql.com/doc/mysql/en/insert-speed.html
Disabling the keys during import will probably help a lot.

Regards,
Bill K.
Jul 23 '05 #4

Bill Karwin wrote:
siliconmike wrote:
Import speed, but without making C fixed length. For example, would
taking C to a different table help?
I'd recommend using the LOAD DATA INFILE statement. The docs suggest

it can up to 20 times faster than inserting using INSERT.


Also query speeds..
Queries like:

select * from T where PRIMARY_KEY=45

It is only column C (varchar) that forces the whole table to be dynamic
format.
If I make C fixed length, it would waste lot of space.

I presume here that queries on fixed length format tables would execute
much faster than variable length ones.

Maybe I can remove column C from T and write the data intended for C in
separate files named by the PRIMARY_KEY.

Or other ideas ?

Jul 23 '05 #5
siliconmike wrote:
I presume here that queries on fixed length format tables would execute
much faster than variable length ones.


Not always. There is reportedly a tradeoff between fixed-length of CHAR
and simply the lesser average size of VARCHAR. Variable length fields
mean more data fits into the same amount of RAM. So it depends on the
physical characteristics of a given dataset.

To be sure, you should try some tests using both CHAR and VARCHAR for a
representative dataset, and run some timings (avoid presuming if you can
actually measure!).

http://dev.mysql.com/doc/mysql/en/cu...enchmarks.html

Regards,
Bill K.
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nick L. | last post by:
All, This is a general question regarding how, and if, compiler optimization techniques affect the general concept of being able to update a component of an application without requiring a...
20
by: Jakob Bieling | last post by:
Hi! I am using VC++ 7.1 and have a question about return value optimization. Consider the following code: #include <list> #include <string> struct test {
5
by: AC Slater | last post by:
Whats the simplest way to change a single stored procedures query optimization level? In UDB8 that is. /F
14
by: joshc | last post by:
I'm writing some C to be used in an embedded environment and the code needs to be optimized. I have a question about optimizing compilers in general. I'm using GCC for the workstation and Diab...
93
by: roman ziak | last post by:
I just read couple articles on this group and it keeps amazing me how the portability is used as strong argument for language cleanliness. In my opinion, porting the program (so you just take the...
22
by: NigelW | last post by:
This is really a question for the development team. Are there plans to improve the optimization of C# to MSIL? I ask this, as inspection with ILDASM of the MSIL code shows that, even with the...
5
by: wkaras | last post by:
I've compiled this code: const int x0 = 10; const int x1 = 20; const int x2 = 30; int x = { x2, x0, x1 }; struct Y {
0
by: Adam Sandler | last post by:
Hello, Using VWD 2005 here... I've noticed I've got .NET services on my system here: the .NET Runtime Optimization service and ASP.NET State service. I've noticed when the ASP.NET State service...
18
by: terminator(jam) | last post by:
consider: struct memory_pig{//a really large type: memory_pig(){ std::cout<<"mem pig default\n"; //etc... }; memory_pig(memory_pig const&){
20
by: Ravikiran | last post by:
Hi Friends, I wanted know about whatt is ment by zero optimization and sign optimization and its differences.... Thank you...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.