database

what this sql does

I have this as a sql statement. What does it do IF(`table`.`field1` IS NULL, '', GROUP_CONCAT(DISTINCT `table`.`field1` ASC SEPARATOR ',') ) AS `MyNewFields`, ...

Cassandra - transaction support

I am going through apache cassandra and working on sample data insertion, retrieving etc. The documentation is very limited. I am interested in knowing can we completely replace relation db like mysql/ oracle with cassandra? does cassandra support rollback/ commit? does cassandra clients (thrift/ hector) support fetching associated o...

Can't create a MySQL query that generates 4 rows for each row in the table it references.

I need to create a MySQL query that generates 4 rows for each row in the table it references. I need some of the information in those rows to repeat and some to be different. In the table each row stands for one day. I need to break the day up in 6 hour increments, hence the four rows for each entry. I need to create one column which for...

Financial Data/Formula Calculation (Storage / Performance)

Hi. I am currently in the analysis phase of developing some sort of Locale-based Stock Screener ( please see Google's' for similar work) and I would appreciate advice from the SO Experts. Firstly the Stock Screener would obviously need to store the formulas required to perform Calculations. My initial conclusion would that the formulae w...

ActiveRecord without setting up database tables? (declarative like Django)

In Django, you fully describe your models in models.py. In Rails with ActiveRecord, you describe part of a model in in the /models directory, and part of it in migrations. Then ActiveRecord introspects model properties from the existing database tables. But I find migrations, columns, and tables to be a headache. How can I do like ...

Django Models / SQLAlchemy are bloated! Any truly Pythonic DB models out there?

"Make things as simple as possible, but no simpler." Can we find the solution/s that fix the Python database world? Update: A 'lustdb' prototype has been written by Alex Martelli - if you know any somewhat lightweight, high-level database libraries with multiple backends we could wrap in syntax sugar honey, please weigh in! from some...

Alternative to a large database

Hi, I am having a database with tables having billions of rows in a single table for a month and I am having data for the past 5 years. I tried to optimize the data in all possible ways, but the latency is not decreasing. I know there are some solutions like using horizantal shrading and vertical shrading. But I am not sure about any op...

Stress testing for a distributed SOA architecture based System

Hi, We currently have a system with 20 SOA services and having a single master mysql database and 2 slave nodes. We currently have 10 GB of data in the database. We have a requirement in which the data in a table is going to be significantly increased. We want to stress test the system before proceeding with the implementation. What kin...

Uploading data to mysql database parallelly

Hi, I have a mysql database and a table of size 74 GB. I am currently using mysql command to load this data into mysql database. It took more than 10 hours and still running. Is there a way to load the data into the mysql database parallelly. One way would be to actually split the table data into multiple files and then call load on eac...

Why repeat database constraints in models?

In a CakePHP application, for unique constraints that are accounted for in the database, what is the benefit of having the same validation checks in the model? I understand the benefit of having JS validation, but I believe this model validation makes an extra trip to the DB. I am 100% sure that certain validations are made in the DB so...

Where can I learn about the different types of databases?

I am looking into creating a web application that will make heavy use of a database to store data about the different users. Problem is, I don't really know that much about databases, especially in an environment that will (hopefully) have lots of traffic. I have used MySQL before for some basic websites (college clubs, blog, low traffi...

Is the version number in rails schema.rb used for anything

Now that Rails has timestamped migrations, the single version number at the top of /db/schema.rb seems pointless. Sometimes the version number ends up incorrect when dealing with multiple developers, multiple branches, ... Does rails even utilize that :version parameter anymore? And is there any harm in it being incorrect (as in doesn...

What is a faster way to backup and restore a MySQL DB than mysqldump? (faster than 4 hours)

We have a database that is about 3GB (in text) after mysqldump is used to dump a text representation of it, and then mysql < mysqlstatement.sql is used to restore the database. But it takes 4 hours. Is there a way to quickly back up / restore the database instead? It is on a Mac using Ruby on Rails, so one time I set the test en...

SQL query determine stopped time in a rnge

hi i have to determine stopped time of an vehicle that send back to server its status data every 30 second and this data store in a table of database, the fields of a status record consist of (vehicleID,RecieveDate,RecieveTime,Speed,Location). now what i want to do is, determine each suspention time at the point that vehicle spee...

Can't fill a column of NULLs with actual values by making an association to the proper values in the reference table.

I have a table with separate columns for months, days and a varchar column for 6 hour increments for each day ('12AM', '6AM', '12PM', '6PM'). There's also a column that's supposed to have calculated numeric values for each of those 6 hour increments. These calculated values come from some reference table. This reference table contains va...

MultiOS "Jet Database" for C++/Qt?

Hopefully I can articulate this well: I'm porting an application I made years ago from VB6 (I know, I know!) to C++/Qt. In my original application, one thing I liked was that I didn't need an actual SQL server running, I could just use MS Access .mdb files. I was wondering if something similar exists for Qt that will work on multiple OSe...

Efficient way to access a mapping of identifiers in Python

I am writing an app to do a file conversion and part of that is replacing old account numbers with a new account numbers. Right now I have a CSV file mapping the old and new account numbers with around 30K records. I read this in and store it as dict and when writing the new file grab the new account from the dict by key. My question i...

How to optimize this MYSQL table?

This is for an upcoming project. I have two tables - first one keeps tracks of photos, and the second one keeps track of the photo's rank Photos: +-------+-----------+------------------+ | id | photo | current_rank | +-------+-----------+------------------+ | 1 | apple | 5 | | 2 | orange | 9 ...

How Can i Create This Complicated Query ?

Hi, I have 3 tables: projects, skills and project_skills. In projects table i hold project's general data. Second table skills i hold skill id and skill name also i have projects_skills table which is hold project's skill relationships. Here is scheme of tables: CREATE TABLE IF NOT EXISTS `project_skills` ( `project_id` int(11) NOT NU...

How to configure DB connection in a Servlet based JPA application

By default DB connections of JPA applications are configured in the META-INF/persistence.xml, when the application is not deployed to a full Java EE application server. In my opinion it is not very elegant to place such environment specific configuration into a file that is inside a .war file. How could a DB connection of a Servlet based...