473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"create table" speed

I'm wondering if there's any way to speed up create table queries?
Besides upgrading hardware, that is. The very simplest table creation
query, "create table table1 ( field1 INT(10))" is taking about .03
seconds, which compared to other queries (large inserts at .01 seconds)
and previous experience appears inordinately long. Further, it appears
that most of that .03 seconds is some kind of overhead, since the
complexity of the create table query appears to be irrelevant.

Any ideas?

Running: Debian Woody with dotdeb packages.

Jul 23 '05 #1
8 3552
Maybe it's disk access that's slowing you down. Have you tried using the
memory (HEAP) engine? It may not be acceptable for your application to
have the database created in RAM, but it may at least help you track down
the bottleneck.

--
Mike Argy
Custom Office solutions
and Windows/UNIX/OSX programs

Jul 23 '05 #2
Good idea. I just tried "CREATE TABLE t (i INT) ENGINE = MEMORY" a few
times, and it took about the same as MyISAM.

Jul 23 '05 #3
cainlevy wrote:
I'm wondering if there's any way to speed up create table queries?
Besides upgrading hardware, that is. The very simplest table creation
query, "create table table1 ( field1 INT(10))" is taking about .03
seconds, which compared to other queries (large inserts at .01 seconds)
and previous experience appears inordinately long. Further, it appears
that most of that .03 seconds is some kind of overhead, since the
complexity of the create table query appears to be irrelevant.

Any ideas?

Running: Debian Woody with dotdeb packages.

Why are you concerned with how long the create table takes?
This is an operation that you shouldn't be performing very
often. The lack of performance you see is probably because the
developers weren't concerned with the performance.

The overhead you are seeing is due to factors unrelated to the
size and complexity of the table. These include inserting the
table information in an internal dictionary, allocating disk
space, doing the same for any indexes and in some cases even
negotiating with the operating system and creating one file for
the table and one file for each index.

In any event if creating tables is being done often enough to
impact performance modifications to your application(s) and
perhaps even a complete redesign may be in order.

Jerry

Jul 23 '05 #4
In our application, we need to deal with a subset of our main database
as a persistent snapshot over the course of days. Creating tables,
populating them with the relevant subset of data, then after a period
of inactivity archiving those tables for later use seemed (and still
seems) like the way to go.

I was not clear in my initial post, though: this was all happening much
faster earlier. Before, the entire process (create and populate tables,
run calculations) was taking about .5 seconds. Now, just the table
creation part is taking .5 seconds.

I have some questions about the overhead you mentioned. There aren't
any indices in this example table I'm creating, and after testing a
HEAP table (based on Mike's suggestion) and discovering that the query
time didn't change at all, it appears that disk access isn't the
problem. So would that mean the overhead is all internal to MySQL?
Integrating a new table into the internal dictionary (w/o indices)?
What buffers or configuration variables should I play with?

Jul 23 '05 #5
cainlevy wrote:
In our application, we need to deal with a subset of our main database
as a persistent snapshot over the course of days. Creating tables,
populating them with the relevant subset of data, then after a period
of inactivity archiving those tables for later use seemed (and still
seems) like the way to go.


Another solution might be to use existing tables, populate them with
additional datasets, and after a period of inactivity, set a value in an
"archive" field to true. Or set it to some integer to indicate the
snapshot to which the subset of data belongs. Then you can access any
present or historical subset of the data by referencing the snapshot id.
e.g. "SELECT * FROM myTable WHERE snapshot_id = 327".

Remember to define your primary key for that table to a compound key,
using the snapshot_id in combination with whatever unique key you
already had.

Regards,
Bill K.
Jul 23 '05 #6
Intriguing, hadn't thought of that. We need to be able to handle
probably up to ten thousand active snapshots, with the largest table in
each snapshot at around 750 entries. Rather than use an archive flag,
we could actually save SQL inserts to a file ... that would help cut
down the database size.

The performance tradeoffs I see, then, would be the consistent overhead
of opening new tables vs. the increasing overhead of using the
snapshot_id. I'd test it, but I just can't yet justify the time
expenditure to set up an accurate performance comparison. Especially
when creating tables was so quick and painless before.

Jul 23 '05 #7
On Thu, 28 Apr 2005 16:03:33 -0700, cainlevy wrote:
Good idea. I just tried "CREATE TABLE t (i INT) ENGINE = MEMORY" a few
times, and it took about the same as MyISAM.

In the other thread, you mention that it was faster 'before.' Before
what? Did you upgrade MySQL, or move it to a different machine? I have
noticed that the 2.6.x Linux kernel is a bit slower than 2.4.x, especially
the distribution builds. You could probably compile a faster one of your
own, or switch back to 2.4.
--
Mike Argy
Custom Office solutions
and Windows/UNIX/OSX programs

Jul 23 '05 #8
Sorry I haven't responded earlier. Application speed is a problem I'm
trying to deal with in the spare moments. And actually, therein lies
the answer to your question: I don't know what the turning point was,
because I was looking elsewhere when it happened. This instance of the
application has been on the same Debian installation on the same
server, with the same 2.4 kernel. As far as upgrades go, we have been
upgrading both MySQL and PHP4 from the backports available from
dotdeb.org.

So it sounds like the best hope I have of figuring this out is to
install some older MySQL/PHP packages and run comparisons.

Jul 23 '05 #9

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

Similar topics

2
8679
by: Robin Tucker | last post by:
I have some code that dynamically creates a database (name is @FullName) and then creates a table within that database. Is it possible to wrap these things into a transaction such that if any one of the following fails, the database "creation" is rolledback. Otherwise, I would try deleting on error detection, but it could get messy. IF @Error = 0 BEGIN SET @ExecString = 'CREATE DATABASE ' + @FullName EXEC sp_executesql @ExecString
17
3845
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a "table" insert in my "editable region", have it placed in the "center" of the page.. while it display correctly on my browser, with setting at 1024x768 (IE6),
2
2280
by: matt | last post by:
Hi all- I'm trying to port an ajax spell-checker (http://www.broken-notebook.com/spell_checker/index.php) to use with the moin moin wiki and have been somewhat successful. (By successful I mean I can spell check using the php backend and my python port running as cgi-bin). My question is this: moinmoin runs on many python web backends (cgi-bin/mod-python/twisted/standalone). My spell-checker backend runs
0
1450
by: Alf P. Steinbach | last post by:
The seventh part of my attempted Correct C++ tutorial is now available, although for now only in Word format (use free Open Office if no Word), and also, it's not yet been reviewed at all -- comments welcome! "Create beginner's programs" <url: http://home.no.net/dubjai/win32cpptut/w32cpptut_01_07.zip> This part focuses on basic techniques and approaches to programming, so it could have been titled "Basic methodologies and...
1
7245
by: DB_2 | last post by:
Greetings, I was searching Google for ways to turn off transaction logging for some queries. I came across this old post from Feb 2003: > From: fareeda (fareeda@pspl.co.in) > Subject: Re: Question related to "CREATE TABLE AS SELECT" in DB2 > Newsgroups: comp.databases.ibm-db2 > Date: 2003-02-27 21:11:59 PST >
5
1830
by: kiask2343 | last post by:
Ok before I get started let it be known I am the definition of a newbie when it comes to access and VBA. I know very little about access and nothing about VBA. I am in the Army and am tasked with making a maintenance program for medical equipment. I have the database, the query, the forms, and the reports. I was able to figure those out, but there is one thing that is beyond me. Ok I have three tables call them table "A" table "B" and...
8
5544
by: wecka | last post by:
Does any one know to bound the choices of an option group to a table. Table structure is ID, Text which shall map to Text, Value for the radio buttons repectively. Appreciate advice. - Hany
1
2354
by: pat | last post by:
I know this is a long shot, but is there any way of dumping a bunch of SQL "create table" statements from an existing Access 2003 database, to say for example, convert the database to MySQL/Oracle. -pat.
1
12760
by: dave.j.thornton | last post by:
I'm attempting to create a new table, and populate it using the fields from two existing tables. The code is printed below. I get the error: "Run-time error '-2147217900 (80040e14)': Syntax error in CREATE TABLE statement." For what it's worth, when tested independently, the "SELECT " part of my CREATE TABLE statement works properly. Sub test() Dim cmd As ADODB.Command Set cmd = New ADODB.Command
0
8653
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8304
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8455
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7126
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6101
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4065
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2587
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 we have to send another system
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.