Tech Reviews, Guides, Articles, and Forums for PC Hardware, Modding, and Gaming Enthusiasts
Fury-Tech Forums

Go Back   Fury-Tech Forums > Software Forums > Programming and Coding

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2004, 01:17 AM
Packetrat's Avatar
Greater Overmind
Greater Overmind
 
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
Packetrat is on a distinguished road
Default PHP/MySQL delay of processing

Apparently two of my MySQL INSERT statements run too fast to ensure that the datetimes are at least one second off of each other. Anyone have any suggestions as to the best way to ensure two 'modified' dates are at least 1 second apart so that I may properly order them using ORDER BY.
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei

Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)

Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-14-2004, 02:20 AM
Tekime's Avatar
Administrator
Great Diviner
 
Join Date: Aug 2002
Location: Maine
Posts: 5,248
Rep Power: 10
Tekime is on a distinguished road
Send a message via AIM to Tekime Send a message via MSN to Tekime Send a message via Yahoo to Tekime
Default

Well, if you really want to force them to be one second apart, you can grab the current unix timestamp and increment by one on each insert; then convert to the proper format using PHP's date() function, then run the query.

If you have concurrent INSERT's this will foul everything up of course. Additionally, if you're inserting a lot of records the timestamp will get increasingly less accurate. 2,000 records will introduce almost a 30 minute gap in your data, while the INSERTs should be well under a minute on a reasonable server. The faster the hardware gets, the larger the recordsets, the wider the gap. 100,000 INSERT's on a dedicated quad-Xeon with 4GB of RAM would introduce a nearly 28 hour gap, under ideal conditions ~1:1680 ratio to the actual timestamps.

Okay, that's probably far from what you're trying to accomplish, but it's fun to speculate.

If you can't just depend on an autonumber field, which will always be sequential even on concurrent INSERT's, you could create an index (not a MySQL table index, just a ticker so to speak), and save each incremented index to a new column in your table. As long as you're only concerned with sorting on each batch, that would be sufficient (if not introducing some possibly unnecessary overhead).

Maybe I'm missing your point though -- you said two queries, so the situation could be different if you're comparing just these pairs.
__________________
ABIT NF8 | Athlon 64 2800+ | 1GB Corsair XMS PC-3200 | MSI GeForce 6600GT

My blog, business, Twitter, ryze, LinkedIn, Digg, Facebook
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-14-2004, 10:07 AM
Packetrat's Avatar
Greater Overmind
Greater Overmind
 
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
Packetrat is on a distinguished road
Default

Interesting... I never thought about all that. Anywho, I'm just talking about two INSERTs that run back to back, not more. What it is that I'm trying to do is create a discussion link between my forum and my blog such that first a new thread is created, then the first post (the first INSERT I need to worry about) will quote the blog entry and the second post (second INSERT) will be the user's actual discussion text.

However, now that I'm looking at this from another angle - now this morning - I could simply combine the quote and the discussion into one post and not worry about it.
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei

Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)

Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-14-2004, 10:09 AM
Packetrat's Avatar
Greater Overmind
Greater Overmind
 
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
Packetrat is on a distinguished road
Default

I love rhetorical logic...
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei

Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)

Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-14-2004, 07:22 PM
Packetrat's Avatar
Greater Overmind
Greater Overmind
 
Join Date: Feb 2003
Location: Colorado
Posts: 887
Rep Power: 6
Packetrat is on a distinguished road
Default

Using 'ORDER BY created DESC, id ASC' works just great of course! Thx.
__________________
I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use. - Galileo Galilei

Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. - Thomas Jefferson (3rd US President, author of the Declaration of Independence)

Justice is the [ultimate goal] of government. It is the [ultimate goal] of civil society. It ever has been and ever will be pursued until it be obtained, or until liberty be lost in the pursuit. - James Madison (4th US President, "father" of the US Constitution)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-16-2004, 05:21 PM
Tekime's Avatar
Administrator
Great Diviner
 
Join Date: Aug 2002
Location: Maine
Posts: 5,248
Rep Power: 10
Tekime is on a distinguished road
Send a message via AIM to Tekime Send a message via MSN to Tekime Send a message via Yahoo to Tekime
Default

Right on!
__________________
ABIT NF8 | Athlon 64 2800+ | 1GB Corsair XMS PC-3200 | MSI GeForce 6600GT

My blog, business, Twitter, ryze, LinkedIn, Digg, Facebook
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Currently Viewing
Go Back   Fury-Tech Forums > Software Forums > Programming and Coding




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Credit Card Processing, Shopping Carts, and more... Packetrat Jibber Jabber 2 06-09-2005 08:29 PM
MySQL Query Browser Packetrat Programming and Coding 1 09-07-2004 02:58 PM
php + mysql install all? sp0om Programming and Coding 1 06-13-2004 03:06 PM
mySQL Confrence freshtokyo Programming and Coding 3 04-05-2004 04:27 PM
MySQL Query Buffers Packetrat Programming and Coding 1 02-23-2004 10:02 PM


All times are GMT -5. The time now is 08:29 PM.


PHP Scripts
BidVerve Directory
PageRank Script
SEO Scripts
37 SEO Scripts
List Cleaner Script
Keyword Cleaner
Directory Script
Directory Script

Directories
BidVerve Directory
BidVerve Directory
Nerve Directories
Nerve Directories
Directory Grow
Directory Grow

Our Supporters
entertainment sites
online casino

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc.