mysql

Is it bad practice to query two different databases on one page?

I'm working with a programmer who doesn't want me touching his database... I would like work with a database instead of hard coding my content but don't want the sites performance to suffer. Is it bad practice to query two different databases on one page? If its not a problem is there a limit to how many databases you can query per pa...

Mysql timestamp timezone wierdness

So I want to grab records from a table based on the day of the month the record was created. This information is stored in a unix timestamp. During testing I created new test records and through in some timestamps for specific day and times that I had converted to timestamps using an online converter. I used... 01/29/2010-02:00:00 R...

MySQL in AWS EC2 - How does it scale?

When you move beyond using one instance for your database, what is the best practice when using EC2? If the first instance is a master and you're spinning up slaves, they would need to scan the transaction log and bring themselves up to date before the slaves are useable correct? If the master had been running awhile and was busy, this...

MySQL Composite Foreign Key Insert Failing

I have 2 tables with a composite foreign key between the 2. When I try to insert a row into the child table, I get a restraint failure, even though the values exist in the parent table. Here's a overview of the parent table: CREATE TABLE `residual_reports` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `processor` enum('1','2','3...

How to exclude rows where matching join is in an SQL tree

...

MYSQL/PHP How do I insert a null value?

I'm having problems updating records to contain NULL values - in particular, a field which is of type Date. I'm using prepared statements and I've tried the following: // Fails $value = NULL; // Fails $value = ""; // Fails $value = "NULL"; all 3 of the above result in a date of 1969-12-31 being entered (0). How do I insert NULL val...

how to update the unchecked checkbox from checked checkbox into mysql using php

how to update the unchecked checkbox from checked checkbox into mysql using php ...

String length at the start of a MySQL text field when using HYDRATE_NONE?

Hi, I'm using Symfony 1.4 with Doctrine. I'm saving text as MySQL text type (Doctrine "array" type) into the database, and it goes in clean & correct. When querying the data back, if I use Doctrine_Core::HYDRATE_ARRAY the data is returned as it should be. However, if I use HYDRATE_NONE, the data is returned with the text length append...

question about InnoDB deadlock in MySQL?

I found this kind of interesting problem in MySQL InnoDB engine, could anyone explain why the engine always claim it's a deadlock. First, I created a table with a single row, single column: CREATE TABLE `SeqNum` (`current_seq_num` bigint(30) NOT NULL default '0', PRIMARY KEY (`current_seq_num`) ) ENGIN...

MySQL: Add stoplist

How could I add a own stoplist to MySQL 5? ...

How would you go about improving MySQL throughput in this simple scenario?

I have a relatively simple object model: ParentObject Collection<ChildObject1> ChildObject2 The MySQL operation when saving this object model does the following: Update the ParentObject Delete all previous items from the ChildObject1 table (about 10 rows) Insert all new ChildObject1 (again, about 10 rows) Insert ChildObject2...

Malformed packet error during MySQL LOAD DATA LOCAL INFILE

I am trying to load a file into an MySQL(v5.1.38) innodb table using PHP's mysqli::query and a LOAD DATA LOCAL INFILE query. The query returns a 'Malformed packet' error code 2027. Any ideas what is wrong? Here is the target table: CREATE TABLE `zbroom`.`lee_datareceive` ( `a` varchar(45) NOT NULL, `b` varchar(45) NOT NULL, `c`...

Hosting a Silverlight database application that works with MySQL

I have a basic hosting package that gives me access to create a MySQL database. I can of course host silverlight applications on any site. But how can I work with a database from within Silverlight? I cannot run any service on my hosting provider, they only allow php or perl scripts. ...

Thinking sphinx/mysql for non text search

Hi Where I have a search which has a category (foreign key) and optional text, should I use thinking sphinx to "search" where a search string has not been submitted, solely the category? ...

How to setup Replication or Federation between MySQL and Derby?

Perhaps this is not possible yet, but... What's the easiest way to setup Replication or Federation between MySQL and Derby? I need a way for data updates/inserts/deletes into a certain table in Derby to automatically flow into an equivalent identical table in MySQL, as quickly and efficiently as possible. This can be done in applicati...

An array stored in MySQL is not recognized as a value

I am trying to store a json encoded array into a MySQL field. The stored array is in the form: ['value1', 'value2', 'value3'] Then I try and run a query like: SELECT * FROM mytable WHERE arrayfield it returns no results. The arrayfield is either blank or contains an array, so I am trying to get the records that only contain an array ...

mysql unique key and index

in MySQL, If I create a unique key on two columns, say UNIQUE KEY my_key (column1, column2) is it necessary to build another key on column1? My goal is to have column1 and column2 to be unique, and I'll do lots of selects keyed by column1. ...

Who are using all the memory on my production server(apache + mysql + rails) ?

I am running a EC2 small instance as my production server. It has 1.7G memory. I noticed it uses almost all memory. However when I check top output, it looks like that only 30% is actually used. Did I misread the top output? Here is the top output (sorted by %MEM) top - 21:33:15 up 141 days, 9:39, 2 users, load average: 0.00, 0.00,...

Delete Old or Redundant Post Metadata from Wordpress

Hello - it appears that somehow in the past, wordpress saved multiple redundant post-meta for post revisions which are no longer in the database. As a result, I have a ton of post-meta that does nothing and is tied to posts that no longer exist. Does anyone know how to remove this data in myPHPAdmin with a SQL querey? Thanks in advanc...

MySQL is there a Single Select to Query Various Unrelated Values from a database?

I saw somewhere what seemed to be nested selects, one "master" select on the "outside" and a series of selects inside- is this possible? I'm not talking about joins as there is particular relation between the selects. I seem not to be explaining myself very well. I want to do a single query which will pull out a series of stats from var...