Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Time Out Message When Query Large Tables


I'm trying to get data from 6 large tables but the volume of data in each table is too large and even select * from one of them make the system stop. I have afew questions:

1-what can I do to avoid the system stop or time out message?

2- To use several tabels infomation should I use 'View' command or can I use other methods?

3-I need to create a new table and insert the result from query in it. If I use the "view" can I insert the result of the view in a table?

(I use postgresql).




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Converting A TIME Field Into Seconds : Error Message
CREATE TABLE `m010` (`date` date NOT NULL, `hour` time NOT NULL, `duration` time default NULL, `cs` int(11) default NULL, `id` bigint(20) NOT NULL auto_increment,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC

the field 'duration' is in TIME format (thus 00:00:00) .. I want to convert it in seconds.

I've read that I can do something like this:

mysql> select duration, TIME_TO_SEC (m010.duration) AS 'ts' from m010 WHERE id = 736;

Problem is, I get this error :
ERROR 1305 (42000): FUNCTION m010.TIME_TO_SEC does not exist

View Replies !
I Get Ignoring Query To Other Database Message
Does anyone know why MySQL Monitor generates this message:

Console: Ignoring Query to other Database

I get this when I try to do anything but the "use databasename" command. example:

Console: use users>create table person1 .....

View Replies !
Simple Message Board Query Question
my table "messages" looks like this:
id
parent_id
root_id
title
author
timestamp
Maybe it is possible to pull out latest threads with last post data
My query only shows replies and last post time, but I want a complete row of the last post
SELECT threads.*, COUNT(posts.id) - 1 as replies, MAX(posts.time) AS lastpost
FROM messages AS threads
LEFT JOIN AS messages AS posts ON posts.root_id = threads.id
WHERE threads.parent = 0
GROUP BY threads.id
ORDER BY lastpost DESC


View Replies !
Can Error Message Show Entire Sql Query Instead Of Excerpt
I'm running MySQL 3.23.58 on Red Hat Linux 9.

In my web server error log I see things like:

[Thu Jan 18 00:33:56 2007] [error] [client 72.86.29.196] DBD::mysql::st
execute failed: You have an error in your SQL syntax near ' (NOW(),
"Setup [precheck] failed for 72.86.29.196 port 1239 [72.86.29.196]
(Con' at line 1 at /var/www/html/blah/mysql-help.pl line 34.

Is there a MySQL setting I can change somewhere so that it will log the
entire SQL query that generated the error, instead of just an excerpt?
It's a lot easier to figure out what went wrong if I can see the whole
query.

View Replies !
Large Tables
So i've got a table with 15 million rows. id is the primary key

SELECT COUNT(id) FROM listings WHERE id != 0;

Takes about a minute to load... which is insanely slow..
anyone know what could be causing this?

View Replies !
Very Large Tables
I am looking at using mysql to store some particle physics data. So the idea is (for example) I would have a table with a list of events, then a table with a list of particle types (one event can have many particles) and so on. The problem is that quite often I want to calculate something for every single event, but this table might run into 10s of millions of events and many GB. Obviously it would be mad to load the whole result set into memory then iterate over it. My question is: is there any way to have the db push results to the users one (or a few) at a time in an effiecent way? I was thinking of something like an iterator that pulls the data from the disk one (or few) at a time. An alternative (but much less useful) method might be to hand the function I want to calculate to mysql, for example:
select myfunc(x,y,z,a,b,c) from events where energy>3;
But as far as I know there is no way of defining your own functions in SQL

View Replies !
Large Table Or Many Tables?
I posted a similar question about 6~12 months ago with no definate answer, so I will give it another go, as the choice has popped up again in my programming life:

If the number of entries is the same is it more efficient (better) to have a single table with many columns, or many tables with few columns? The obvious answer is a single table, because there is less closing and opening tables, but the reason why I ask is what about searching through a lot of columns being even more inefficient?

The situation is I need to record data for every week of the year. Say ~50 columns per week --> 2600 columns. Or, do I split it so it's 52 tables with 50 columns each? In each of these options the user (or user ID) will be the primary key.

The seemingly pointless other option is to insert new columns with every new user, and have the week-item as the primary key?

View Replies !
Large Number Of Tables
I would like to ask whether it is feasible (or whether it makes sense) to run a PHP script that creates a number of tables for each user.
Basically, this script allows users to sign up for a free service, and for each user that signs up, the script creates 9 tables in the database to contain that user's details.
Is this a sensible way of containing user data, and what are the inherent problems this may cause especially when say are 1000 users signup?

View Replies !
Large DB Should Use Multiple Tables?
I have a social networking site similar to myspace, currently my table which links who is who's friend on my site is 2 weeks old and is at 300,000 rows but is only at 15mb in size, this is the most accessed table of all my tables.

My question for performance, as this table grows should it eventually make a new table? If so here is my current select code

select userid,friendid,status from friend_friend where userid='$temp[auto_id]' and status='1'

Could someone give me an example of how o select this from multiple tables if I add more for this table in the future?

View Replies !
Managing Large Tables
I recently inherited a database (version 5.0.18) that has 1 table constantly growing out of hand between 10GB -30GB, therefore making is difficult/impossible to query. Also, the Archive Storage Engine is not installed. Currently, the table is manually renamed (i.e. tablename_daterange) and a new table created. ....

View Replies !
Join Tables On A Large Database 200 Meg
i am trying to work out the most efficient way to list say multipl=
e categories of entries, the database is quite large about 200 meg.=20

I would like to know if using join tables is more efficient than storing th=
e keys in a varchar field then within the second loop doing a where in (1,2=
,3,4) where the 1,2,3,4 are the stored category keys in the varchar field =
rather than a where in (1), where 1 is the pirmaryID of the entry for insta=
nce ?

View Replies !
Optimizing Mysql For Large Tables
I have been working with Mysql for about 5 years - mainly in LAMP shops. The tables have been between 20-100 thousand records size. Now I have a project where the tables are in the millions of records.
This is very new to me and I am noticing that my queries are really slowwwwww!
What are the options that I have to speed my queries on the mysql side with regards to the my.cnf file. I have a fair understanding of sql optimization and I understand explain. I just want to see if there is something that I can do with the server also.

View Replies !
Slow Join On Large Tables
I have two tables:

D (500,000 recs), and DL (2,500,000 recs)

D has a PK and an index on HLQ. DL has a PK and an index on ID.

The following SQL:

SELECT
HLQ as "HLQ",
count(*)
FROM
D, DL
WHERE
D.DLID=DL.ID
GROUP BY HLQ

produces the following explain:
tabletypepossible_keyskeykey_lenrefrowsExtra
DALL500000Using where; Using temporary; Using filesort

DLeq_refIDID4D.DLID1Using index

The query takes ~ 3:30 on a Athlon xp2200; 1GB RAM; default bufer settings. Adding the following buffer settings only slightly decrerased the time (~3:00).

key_buffer=512M
table_cache=256
sort_buffer=16M
read_buffer_size=16M

It appeasrs that the 'Using filesort' on table D is due to the Group
By clause and is the problem. I have an index on HLQ. Is there any
way to get MySQL to use it?

View Replies !
One Large Table Or Many Small Tables?
I'm trying to decide whether to use one large table or many small tables.
I need to gather information from various devices (about 500). Each device
has its own Id and some data.

Should I use only one table with an indexed column for the ID and another
column for the data, or should I use 500 tables each with only one column
for the data?

View Replies !
One Large Table Or Several Smaller Tables
From a speed of access standpoint, is it better to have one large table or several smaller tables? I'm in the early stages of development, so I can go either direction with this.

View Replies !
Large Tables, Very Slow Deletes.
I've been using MySQL for a while now and are starting to run into limitations. Either my own, or something else.

I have this really large table, it stores images, it has a mediumblob field, an unsigned id integer field and a timestamp field. This table contains up to a few million rows and is constantly filled real time. It grows up to sizes between 50 and 100 gb and in the future probably even larger.

This data is not supposed to be stored for all time, therefor when a certain treshhold is reached, the oldest 5000 rows are deleted to make room for newer rows. This is where my problem kicks in. Whenever I try to delete those rows, it can take for ever to complete. 500 rows I can delete without problem, 2500 becomes slow, 5000 rows takes several seconds and 10.000 rows or more makes it looks like things are frozen.

Now the temporary solution I have is to delete 500 rows at time, but this means I must do that every 10 seconds just to maintain status quo. I would much rather check every 5 minutes or so, and if needed delete 15.000 rows in one go.

I use MyISAM tables and tried setting the key size to 128M, no luck. I run this on a dual Opteron system with a GB of memory and WinXP-SP2 Proffesional.

View Replies !
Large Unused Tables Vs Performance
I've been working on a website with a rather large a database. One of the about 100 tables in there was about 1/4 of the total database size.

The table had no use anymore at the time I worked the website, so it was just sitting there, doing absolutely nothing. Obviously to spare diskspace we deleted the table.

But the question I have now, can unused large tables affect the perfomance of Mysql?
I've searched a bit around, but honestly I couldn't find a clear answer about it right away (maybe I haven't searched enough either :) )

View Replies !
One Large Table Vs. Many Small Tables
I'm working on a design using PHP & MySQL and I'd like to get some opinions on this.

My design has several tables that will be referenced but I'm wondering if those tables should be broken down even more and referenced more dynamically. The reason that I wonder about this is for long term goals. I hope that eventually there will be two or three thousand records that will be used on a regular basis. These records will need to be separated into groups, but I'm not sure if I should use a field in the database table or create a new table for each group.

If a few hundred records could be in each group, do you think it's better to use one large table with a field for the group ID, or a new table for each group?

View Replies !
Large Number Of Tables And Columns
i'm developing an online portal, which my MYSQL database contains 100 tables.. my doubt is if any table contains 30-40 columns will it become a problem? like my html front end form has 40 fields for data insertion. and i'm not maintaing any duplicate data if my DB contains 100-150 tables will it create any problems?

as i'm inserting data from EXCEL via PHP to MYSQL, please suggest me whether a healthy MYSQL table is dependent or independent on NO:OF COLUMNS(FIELDS) or not?

View Replies !
Speeding Up Large MySQL MyISAM Tables
I'm somewhat new to MySql. I've been using it for a while, but pretty much
out of the box setup, and am starting to suffer heavily with my larger
tables. I have a table with 5,000,000+ rows that I have to search and do
joins on. Although I have an index set up for it, the joined select will
still take some 400+ seconds to return, which is obviously unacceptable.
This is due to enormous HD access.

Perhaps someone can help me with indexes here; I was under
the impression that the index for the tables are cached in memory, and
therefore permitted "instant" searchability, without having to retrieve data
from each of the rows of the DB. Is there a startup parameter, or
something in the mysql.ini file, that must be set to allow for this? I have
the index configured properly, and have made sure that the query uses there
parameters in the where clause in the same order that they appear in the
index. Code:

View Replies !
Speed Of InnoDB DELETEs On Large Tables
I am finding delete queries on large InnoDB tables very slow - are
there ways to speed this up?

I have a table with about 100 million rows:

I am trying to delete just a few of these rows (the following select
takes a couple of seconds):
[color=blue]
> SELECT count(*)[/color]
-> FROM UserSnap
-> WHERE LogDate<now() - INTERVAL 750 DAY;
+----------+
| count(*) |
+----------+
| 308969 |
+----------+
[color=blue]
> DELETE FROM UserSnap WHERE LogDate<now() - INTERVAL 750 DAY;[/color]

That delete query takes hours to run. The structure of the table is:
[color=blue]
> desc UserSnap;[/color]
+----------+-------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------------------+-------+
| LogDate | datetime | | PRI | 0000-00-00 00:00:00 | |
| Period | tinyint(4) | | PRI | 0 | |
| UserName | varchar(50) | | PRI | | |
| RateType | varchar(50) | | PRI | default | |
| Rate | float | YES | | NULL | |
+----------+-------------+------+-----+---------------------+-------+

Any suggestions on why this is slow, and what to do about it?

View Replies !
Random Records :: Rand() On Large Tables?
Im told that ORDER by rand() isnt a good idea to use on large tables, so Im interested to know how else this could be done. I need to display 20 random records (there are conditions in the WHERE clause as well).

View Replies !
Loading Large Tables From Files (wikipedia)
I'm an Oracle DBA and new to MySQL.
I was trying to load a 5.6 GB xml file onto mysql database using mediawiki tools.
The performance decreased gradually and crashed at ~60% completion.
Now I'm planning to use xml2sql tools to convert the dumps to txt format.
Then I'm planning to load this using mysqlimport.
I would like to run this load faster, and on Oracle, I would use the IMP parameters
such as INDEXES=n and so on. What are the recommended steps when using mysql?
Should I target any of the system variables?
I have a 4G ram on the server and can use all of it for the load.
Any pointers?

View Replies !
Create Table Syntax For Large Tables
How do i create tables with sizes larger than 4 GB? Do I need to specify any additional clauses such as heap etc when creating tables?

View Replies !
Selecting From Multiple Large Tables Quickly
My skills with MySQL typically end at "SELECT * FROM table WHERE stuff", so I've had a lot of trouble with optimizing this query. I've tried doing multiple select statements for this, but that usually comes out with an average execution time of 99s. This method has a execution time of 6s still, so I'd like to get it down.

I have 4 important tables here (I'm only posting the columns which I use):

`auth`

UID mediumint(8) unsigned PRI NULL auto_increment
username varchar(32) MUL
clan_id mediumint(8) unsigned MUL 0
clan_abbrev varchar(7) MUL
`clans`


ID mediumint(8) unsigned PRI NULL auto_increment
Abbrev varchar(7) MUL
Name varchar(64)
icon_id smallint(5) unsigned 0
`stats`

UID int(10) unsigned PRI 0
kills mediumint(9) NULL
`usernames`

UID int(10) unsigned 0
ID int(10) unsigned PRI NULL auto_increment
Name varchar(32)
Uses mediumint(9) 0
`auth`, `stats`, and `usernames` are linked by `UID`. `clans` is linked to a row in `auth` based on it's `clan_id`.

I need to search the `usernames` table for a `Name` which matches a certain text (I use "storm" in my example below). I need to return a result with matches to that search, with each row containing:The `UID` which links the tables together for that user.The matching `Name` from `usernames`The matching `username` from `auth`The `Uses` from `usernames`.The `clan_id` from `auth`.The `Abbrev` from `clans`.The `Name` from `clans`.The `icon_id` from `clans`.The `kills` from `stats`.
The result should be ordered by `Uses` (from `usernames`) -- highest to lowest.

The tricky part is that some users may have &#390;' as their `clan_id` in the `auth` table, in which case the clan id, abbrev, name, and icon_id should all be blank (0 or '' based on the type).

Here's what I managed to hammer out with my limited knowledge of SQL:


(
SELECT usernames.UID AS `UID` , usernames.Name AS `result` , auth.username AS `playername` , usernames.Uses AS `Uses` , auth.clan_id AS `clan_id` , clans.Abbrev AS `clan_abbrev` , clans.Name AS `clan_name` , clans.icon_id AS `clan_icon` , stats.kills AS `kills`
FROM `usernames` , `auth` , `clans` , `stats`
WHERE usernames.Name LIKE '%storm%'
AND auth.UID = usernames.UID
AND clans.ID = auth.clan_id
AND stats.UID = auth.UID
)
UNION (

SELECT usernames.UID AS `UID` , usernames.Name AS `result` , auth.username AS `playername` , usernames.Uses AS `Uses` , 0 AS `clan_id` , '' AS `clan_abbrev` , '' AS `clan_name` , 0 AS `clan_icon` , stats.kills AS `kills`
FROM `usernames` , `auth` , `stats`
WHERE usernames.Name LIKE '%storm%'
AND auth.UID = usernames.UID
AND auth.clan_id =0
AND stats.UID = auth.UID
)
ORDER BY `Uses` DESC
It works great, but the average query takes around 6s (these tables have several thousand entries in each).


View Replies !
Large Join Query
I am at a loss. Right now I have a PHP script that needs to run a huge join query. They query joins two tables of approximately 200,000 records. I'm running mysql 3.x so I can't use a view... at this point indexes don't seem to help. I am thinking the only way to do this is with script processing

View Replies !
Large Query Times
SELECT distinct column1 FROM table1, table2 WHERE column1 <> column2 ....

View Replies !
Mysql_fetch_array() And Large Query
I am running a SELECT query on a table of about 1.6 million records.

The number of rows I get back is about 1.5million. SQL runs fine, in command line and php, but when I try to move data from 'resource' to an array with mysql_fetch_array() my browser stalls.

So my question is, am I overflowing the buffer somewhere, and if anybody has a clue how to fix this.

View Replies !
Help Me Refine This Large Join Query
$sql = "SELECT f.*, p.post_time, p.post_username, u.post_subject,u.post_text,v.username
FROM (( " . phpbb_forums . " f
LEFT JOIN " . phpbb_posts . " p ON p.post_id = f.forum_last_post_id )
LEFT JOIN " . phpbb_posts_text . " u, phpbb_users v ON u.post_id = p.post_id and ON v.user_id=p.poster_id)
ORDER BY f.cat_id, f.forum_order";

Right now its select all the posts from every forum, I just want it to select the last post from every forum and the second join on phpbb_users don't seem to be working as the user_id doesn't seem to be matching on the poster_id, any suggestions?

The query also doesn't work, I want phpbb_posts to left join to two tables, posts_text and posts_topics, how to I do that?

View Replies !
Noob: Select Large Query
If I had to select large number of records, say 1 million from the mysql server. What problems would I be facing? MySQL connection timeout, network latency?

Anyone has done a large simple mysql select query and what problem did you face? I am not doing any joins.

View Replies !
Retreiving Large Query Results In Chunks
I'm running queries with MySql 4.0.17 that return thousands of
records. Because I need to present them in GUI, I returieve the
results in chunks using LIMIT, for example - get first 100, then the
range 100-2000 and so on.

The problem is as follows: in the first chunk, MySQL uses one strategy
to fetch the results, and in the following chunks - a different
strategy.
This means that records from the subsequent queries might have records
that already appeared in the first query or that some records will be
left out.

For performance issues it is a problem to add a unique secondary
sorting criteria (like id) to the query.

Is there a clean way to force MySQL to relate to the first (initial)
query result set?

View Replies !
Large Table, Slow Query Question
I have a table with ~800,000 records. I need to grab random rows from the table based on certain criteria. The problem is that average lowest subset to grab the random row is around 200k. Here is what I'm trying to do:

There are 4 columns: data,n1,n2, and n3. I need to get the value of the data column based on criteria using the n1-n3 columns.

The most common query is SELECT data FROM table WHERE n1 = ?

The problem is that n1 can be only 1 of 5 possiblities. When the table is finished being populated there will be roughly 1.5 million records and 250k for each value of n1. Of course, I have an index on each n column.

Right now with just the 800k records it can take over a second, sometimes multiple seconds to run the following in order to get a random row from that subset:

SELECT COUNT(1) AS total FROM table WHERE n1 = 3;
index = random number from 1 to total
SELECT data FROM table WHERE n1 = 3 LIMIT index,1;

How can I speed this up? I need it to take less than half a second if possible. Thank you.

View Replies !
Batch Query Or Large List Of IN() Arguments?
I'm receiving a potentially large list of productID numbers from an external data source.

Each productID has a number of partID's associated with it and those partID's are stored in my database.

I would like to create a list of products sorted by the number of parts each has.

If I only have one table called "part" which stores a partID and its associated productID, which of the following methods would be more efficient assuming the application and DB are on the same server.

Option A)

SELECT productID, Count(*) counter
FROM part
WHERE productID
IN(large list of productID's received, maybe 1 or >10000)
GROUP BY productID
ORDER BY counter DESC
LIMIT ?, 10

Option B)

Execute a batch query of prepared statements (SELECT COUNT(*) FROM part WHERE productID=?) for each product in the received product list then sort the returned results in the Java app that is making the query.

Option C)

???

View Replies !
Speed Up Large Table SQL Select Query
I got a very large SQL table (50 million rows). The simple select query is running repeatedly and is identified a bottleneck.

Here is the detail info: ....

View Replies !
Using Limit On Grouped Query With Large Number Or Records
I have a query that use a "group by" clause that returns 600+ queries

however if I add a LIMIT 500,50

It returns 0 records. I tested LIMIT 450,50 and it returned only 34 records.

Is there something limiting the limit? Is there an option in mysql that can increase this limit?

View Replies !
Query On Large Table When Implementing Paging With LIMIT?
I'm working on a paging implementation but I am stuck on a couple of things:

1) I tested with a simple query which yielded this:

EXPLAIN SELECT create_date FROM threads LIMIT 0,25

id=1
select_type= SIMPLE
table=threads
type=index
possible_keys=NULL
key=create_date
key_len=4
ref=NULL
rows=57852
extra=Using index

I thought that the LIMIT clause would limit the number of rows scanned, why is it still showing 57k rows?

2) Assuming there is a simple fix to the above, now if I want to order by create_date (SELECT create_date FROM threads ORDER BY create_date LIMIT 0,25) I understand that mysql must pull the entire table to sort the data set before applying the limit. So the explain would probably look a lot like the above. In this instance, is there a more scalable solution to implement a sorted paged result set?

View Replies !
Time Discrepancy In 2 Tables
I have 2 tables I have 3 fields that match, number, date and duration (phone cost list and phone system call log) even with these 3 fields matching the join is not 100% perfect. I need to match the times of the calls but these are from 2 different systems and can be up to 30 seconds out. How can I put that in to a select statement?


View Replies !
Time Zone Name Tables
Having some troubles with an installtion on AIX. We've installed mysql alongside our own product which uses a mysql db. Checking the logs we get an error:

051111 16:52:43 [Warning] Can't open and lock time zone table: Incorrect
information in file: './mysql/time_zone_name.frm' trying to live without them

Tried to read the mysql db and got:

Didn't find any fields in table 'help_keyword'
Didn't find any fields in table 'time_zone'
Didn't find any fields in table 'time_zone_name'
Didn't find any fields in table 'time_zone_transition'
Didn't find any fields in table 'time_zone_transition_type'

and trying to read the 'time_zone_name' table gives:

ERROR 1033 (HY000): Incorrect information in file: './mysql/time_zone_name.frm'

The timezone we have set is CST6CDT, asopposed to one of our other AIX boxes which is GMT0BST. My question is should this be causing a problem, and if so is there a way around it without changing timezones on the box?

View Replies !
Update 3 Tables At A Time
i have 3 tables namely--- artist, journalist and songs.
i try to update the flags in artist and journalist and try to update few fields from songs by firing foloowing qurries.

update songs set sname='lala', sname2='my baby' where artistid=6;
update artist set statusartist='new',flag1='updated' where artistid=6;
update journalist set statusjourn='new',flag1='updated' where journid=4;

when i fire the above querries individually they are excuted without any error.
when i try to run these querries through my JSP application only the songs data is updated and the rest 2 tables are not.

i tried to write 1 combined query including all 3 tables for this,but still it didnt work.
can u please tell me a solution for this.

View Replies !
Access Tables From 2 Clients At The Same Time
if I want to use MyISAM tables in a DB from 2 different clients (from an application) which can manipulate data at the same time.

This works good for about a month but now I have an error that a fieldvalue of a record was suddenly changed but there is no way to do that by the application.
The field has got the data of an other record (so I have this twice), but this value can only exists once. The rest of the data of that record is still correct.

Does anyone know what the problem is?

View Replies !
Time Difference Between Records From Two Tables
I have two tables with data from two separate data loggers. The timestamps of the records are not perfectly synchronised (eg. 2005-07-11 22:50:00 and 2005-07-11 22:49:58). All data must be joined to one table and all records that are out of sync by more then 30 seconds must be rejected. I tried somethig like this: Code:

View Replies !
Copying Tables Every Time They're Updated
I'm got two tables which need to kept upto date with each other. Is there a command i can cron to copy all the updated entries?

View Replies !
Any Way To Insert Data Into Two Tables At The Same Time?
what I have is a table called `order` and a table called `lmcharge`.
a person inputs data from a form and i need to take the data from both and some goes into one table, some goes into another
here is an example:

order values:
student_id, class_id, order_type, date, status
//student_id, class_id, order_type will be from the form

lmcharge values:
student_id, order_id, lm_number
//student_id, and lm_number will also be from the form but order_id will have to be from the order table

anyone have a clue?

View Replies !
Query Time
Is there a function out there to determine the length of time a particular query took

View Replies !
Get Query Time Query Time Using PHP
I just want to ask, how to get query time like this one:

SELECT f_name, l_name from employee_data where f_name = 'John';

+--------+------------+
| f_name | l_name |
+--------+------------+
| John | Hagan |
| John | MacFarland |
+--------+------------+
2 rows in set (0.00 sec) <- This Time <--

Maybe some instruction using PHP?

View Replies !
Time Query - Please Help?
I’m completely baffled by a query that I thought I had working yesterday, but I can’t get it working today.

Here’s the screnario:

I’m publishing a story to the web and I don’t won’t it to be published live until:

-The current date (type: date) is less or equal to now
-The current time (type: time) is less or equal to now

So here’s my query:

select * from cms_stories
WHERE section = 'news'
AND published_web_date <= NOW() OR published_web_date IS NULL
AND (published_web_time <= NOW() OR published_web_time IS NULL)
ORDER BY story_id
DESC LIMIT 1
Now the query works for the published_web_date, but not for the published_web_time. It seems to ignore that as you can see from the screenshot returned below from that query.


View Replies !
How To Update Parent And Child Tables At The Same Time
I'm using phpMyAdmin to learn how to do MySQL queries. Once I figure them out I put them into my PHP code, which I'm also learning.

I can do a SELECT query with a LEFT JOIN and get results.

My next step is to figure out how to update 2 related tables at the same time. I have tblBudget and tblBudgetDetail. tblBudget has tblBudgetID and tblBudgetDetail has tblBudgetDetailID and BudgetID (which should hold the same value as tblBudgetID in the related record tblBudget)

Code:

tblBudget tblBudgetDetail
tblBudgetID--| tblBudgetDetailID
|---BudgetID

crude, but perhaps you get the idea. The join is one to many. One tblBudget to many tblBudgetDetail.

So is it possible to update both tables with one query? I guess the query would have to populate the field BudgetID in tblBudgetDetail with the same value that is in tblBudgetID in tblBudget. Does MySQL do that automatically?

View Replies !
UPDATING Multiple MySQL Tables In The Same Time
I have to perform a query and I don't know how to do it.

It is a Joomla 1.5 guery and here is it:

$_CB_database->setQuery(" UPDATE #__comprofiler SET avatar = " .
$_CB_database->Quote( 'gallery/' . $newAvatar )
. ", avatarapproved=1, lastupdatedate = " .
$_CB_database->Quote( date('Y-m-d H:i:s') )
. " WHERE id = " . (int) $row->id
. "; UPDATE #__mycom SET avatar = " . $_CB_database->Quote(
'gallery/' . $newAvatar )
. " WHERE user_id = " . (int) $row->id
.";");
if( ! $_CB_database->query() ) {
$msg = The query hasn't been performed;
}

View Replies !
Limiting Query Time
Is it possible to limit the query time in MySQL (3.x or 4.0)? For
example, I'd like to have any query that takes more than a specified
number of seconds just quit automatically. Seems dumb, but on a web
site, nobody is going to wait minutes for a query to return so they
refresh anyway. So on a busy server, MySQL ends up with several queries
running that all take a long time to finish which compound to make it
even slower. A simple time limit would solve the problem. Yes, I know
that the queries should take less time, but again, on a busy server,
sometimes the longer queries do take a long time (10 minutes or more)
to complete.

View Replies !
Query Execution Time
I m using inner join where there is no keys (Primary and foreign). I want to know that Does key affects execution times?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved