mysql

Caching item IDs in a memory table - good/bad?

I was thinking....I have a site where there is a lot of searching/sorting going on. What if I cached the result item IDs for each search into a MEMORY table, and then simply did WHERE item_id IN ("1", "5", "44", "67"). If there is no value for the particular query, it does the full query, and writes the IDs into the MEMORY table. Will...

How to change the storage engine type on MySQL?

I would like to use InnoDB as the storage engine on all my tables and databases. Is there a command I can run to change the type of my current tables to use InnoDB instead of MyISAM? Also, is there a way to set this as the default so I don't have to do this again? ...

Does Wordpress.com use ONE set of tables for ALL users?

Does wp.com create a new set of tables for each new blog, or are all blog data stored in one set of tables (with a layout like: http://codex.wordpress.org/Database%5FDescription)? Would it ever be a good idea to create a set of tables for each blog in MySQL, or will MySQL be able to handle large numbers of blogs each with their comments...

Calculating from self-join

I have a list of values and dates for stock ticker symbols and want to calculate quarterly returns in SQL. CREATE TABLE `symbol_details` ( `symbol_header_id` INT(11) DEFAULT NULL, `DATE` DATETIME DEFAULT NULL, `NAV` DOUBLE DEFAULT NULL, `ADJ_NAV` DOUBLE DEFAULT NULL) For fixed quarter start and end dates that works fine: set...

Tracking SQL Calls From MS Access to MySQL

I'm trying to 'see' the SQL statements that are sent from MS Access 2003 to MySQL via ODBC. I've tried ODBC Tracing, but it's painfully slow, producing very large log files which are very difficult to read. For example, and insert looked like this: "INSERT INTO `tracking` (`contract_id`,`bp_id`,`csi_1`,`csi_2a`,`csi_2b`,`csi_code`,`...

Any suggestions for a db schema for storing related keywords?

I have to store a set of related keywords inside a database. As of now, I am thinking of using the following: To store the keywords themselves: CREATE TABLE keywords( id int(11) AUTO_INCREMENT PRIMARY KEY, word VARCHAR(255) ); To store the relations (stores the ids of the related keywords): CREATE TABLE relatedkeywords( id ...

MySQL many to many table to table matrix

Hi, I have a many to many table in MySQL - it can look something like: A | B 1 | 1 1 | 2 1 | 3 3 | 4 3 | 5 4 | 1 4 | 2 4 | 5 etc. You'll notice that the numbers are not always contiguous, (A=1,3,4..) - I am looking for the fastest way to turning this into a matrix table, ignoring columns and rows with no data (e.g. A=2). What I have...

PHP loop acting as cronjob[ensure only one instance running]

Hello everybody, I have a multi part question for a php script file. I am creating this file that updates the database every second. There is no other modeling method, it has to be done every second. Now i am running CentOS and i am new to it. The first noob question is: How do i run a php file via SSH. I read it is just # php path...

postgres - partial column in SELECT/GROUP BY - column must appear in the GROUP BY clause or be used in an aggregate function

Both the following two statements produce an error in Postgres: SELECT substring(start_time,1,8) AS date, count(*) as total from cdrs group by date; SELECT substring(start_time,1,8) AS date, count(*) as total from cdrs group by substring(start_time,1,8); The error is: column "cdrs.start_time" must appear in the GROUP BY clause or ...

Designing database for ebay-like web application

Firstly this site is based on guests who are interested in selling their items to the site owner, so this isn't auction based like Ebay. Visitors basically would enter in details of an item ( tech gadget ) they'd like to sell, including condition, are given a quote on how much the item is worth, then fill in address info so the owner sh...

How to know how many words a paragraph contains in MySQL?

What MySQL function can I use? for example, What Mysql function can I use? contains 6 words. ...

What is wrong in my MYSQL Query?

SELECT ( SELECT SUM(IF(status = 'Active', 1, 0)) AS `univ_active`, SUM(IF(status = 'Inactive', 1, 0)) AS 'univ_inactive', Count(*) FROM online_university ) AS tot_university, ( SELECT SUM(IF(status = 'Active', 1,0)) AS `user_active`, SUM(IF(status = 'Inactive', 1,0)) AS 'user_inactive' Count(*)...

how to run crystal reports in ubuntu linux

Hi all, I am trying to use the crystal reports application in ubuntu. So far i was able to connect the MYSQL database using c# in .net platform and run a small application in ubuntu over crossover linux. But when i try to fetch the data from mysql database and display in crystal reports i get an error as shown in the below picture: ...

Choosing Linux for open source development.

I work on Windows XP platform and use Aptana Studio, MySQL for PHP development. I want to know which Linux edition and flavor would be appropriate for my development purposes? ...

SQL NOT IN Query

Can anyone help me with this MySQL query? SELECT p.ProductID, p.StoreID, p.DiscountPercentage FROM Products p WHERE p.IsSpecial = 1 AND p.SpecialDate >= date_sub(now(),interval 15 minute) AND p.DiscountPercentage >= ?DiscountPercentage AND p.ProductID NOT IN (SELECT lf.LiveFeedID ...

Acronyms with Sphinx search engine

how can i index acronyms like 'm.i.a.'? when i search for 'mia', i get results for 'mia' and not 'm.i.a.'. when i search for 'm.i.a.', i get nothing at all. edit: solution looks roughly like: ignore_chars = -, . ...

How To Reduce Number of Rows Scanned by MySQL

I have a query that pulls 5 records from a table of ~10,000. The order clause isn't covered by an index, but the where clause is. The query scans about 7,700 rows to pull these 5 results, and that seems like a bit much. I understand, though, that the complexity of the ordering criteria complicates matters. How, if at all, can i reduce ...

MySQL optimisation by sorting the rows

Hello everybody! I am not an expert of MySQL, and I have search a lot about the following problem without finding the solution. So, I'm using a MySQL table with this structure: CREATE TABLE photos ( file varchar(30) NOT NULL default "", place tinytext NOT NULL default "", description tinytext NOT NULL default "", type char(1) ...

please can anyone check this code for image uploading

Hi i want to upload only images getting some problem with this please can anyone check below code <?php $target_path = "../test/sites/default/files/ourfiles/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES...

Configure MySQL to work with Django

Just installed Django (with easy_install) and created a project, but can't get mysql to work. python manage.py syncdb throws this error: ..... File "/Library/Python/2.6/site-packages/Django-1.1.1-py2.6.egg/django/db/backends/mysql/base.py", line 13, in <module> raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)...