Re: triggers- how to bring updates in one table to another table

2010-01-28 Thread Alexander Kolesen
CREATE TRIGGER sync_t 
AFTER UPDATE ON table1
FOR EACH ROW
UPDATE table2 
SET name = NEW.name WHERE id = NEW.id;

 i have two tables namely.. table1 and table2, table1 and table2 have the two
 columns samely like id and name, by using triggers i have to bring the
 updates in table1 to table2, if i updated name in table1 trigger has to made
 the same up date for table2. please help me regarding this.
 thnaks in advance

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Best way to synchronize two database schemas

2010-01-23 Thread Alexander Kolesen
One of the ways is to keep db scema under revision control system. And
update it every N minutes.

% crontab -l
0 * * * * mysqldump testdb --no-data  testdb_schema.sql  svn ci -m
db schema: `date`  /dev/null

 I have a two databases, one in a production environment (let's call it 
 db_prod) and the other in a testing environments (Let's call it db_test).

 What is the best way to synchronize the database schemas?  db_test has had a 
 few indexes and constraints added to several tables and I need to generate a 
 MySQL script to apply these changes to db_prod.  So basically I want to dump 
 the schemas of the two database, compare, and generate the necessary script 
 to apply to db_prod.

 Thanks,
 Randall Price



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: SCALING INSERT

2010-01-23 Thread Alexander Kolesen
If you only need very fast INSERTs, you might try to use ARCHIVE
storage engine (
http://dev.mysql.com/tech-resources/articles/storage-engine.html ). It
was developed for handling INSERTs very fast. Many peoples use it, for
example, for storing logs.

 Hi list,

 I want to insert 1 records/sec into table.  There can be n number of
 tables with unique data in each. What are the possible ways to do ?

 Thanks,
 Krishna


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Re: Table advice.

2009-08-01 Thread Alexander Kolesen
Hello.
Your query performs a full table scan, because if you match text with '%...' 
wildcard, MySQL can't using index. Try to use external full-text
search engines like Sphinx (http://www.sphinxsearch.com/) or Lucene 
(http://lucene.apache.org).
 I have a database that I am (will) be using to track URL's. The table
 structure looks like this:
 
 CREATE TABLE event
 (
   eid   INT UNSIGNED NOT NULL AUTO_INCREMENT,
   timestamp INT(10) UNSIGNED NOT NULL DEFAULT 0,
   ipINT(10) UNSIGNED NOT NULL DEFAULT 0,
   fqdn  VARCHAR(255),
   domainVARCHAR(63),
   tld   VARCHAR(63),
   actionVARCHAR(4),
   request   TEXT,
   referrer  TEXT,
   clientVARCHAR(255),
   INDEX eid (eid),
   INDEX timestamp (timestamp),
   INDEX ip (ip),
   INDEX fqdn (fqdn),
   INDEX domain (domain),
   INDEX tld (tld)
 );
 
 The is no real logic behind the indexes, the table was hobbled
 together looking at examples. Currently I am trying queries on about
 300 million records and the results are pretty crappy. for example, a
 query like this:
 
 select domain,count(domain) as count from event where domain like
 '%facebook%' group by domain order by count desc;
 
 takes about 5 minutes to complete.
 
 Most of the queries will be like that above but probably with
 additional filters like date constraints or IP constraints or a
 mixture of both. I can also see searches through the requests for
 filetypes etc.
 
 Any suggestions or comments would be appreciated.
 
 Thanks.
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql?unsub=kolese...@gmail.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org