database

Terribly slow SQL query with COUNT and GROUP BY on two columns

I'm archiving this web forum, which normally gets purged about once a week. So I'm screen scraping it, and storing it into my database (PostgreSQL). I also do a little analysis on the data, with some graphs for users to enjoy, like what time of day is the forum most active, and so forth. So I have a posts table, like so: Column |...

Should I choose relational or non-relation database for social-network like app

Hello, I'm in the process of choosing database for my application. I have been using MySQL for the longest time but for my current application Performance and Scalability is important and I know MySQL has its limitation and I have been hearing a lot about key-value stores, column-based DBs and document-based DBs and others. I have look...

django database many2many relationship errors

hi i am using the following models to build a database from django.db import models from django.contrib import admin class Team(models.Model): """Model docstring""" slug = models.SlugField(max_length=200) Team_ID = models.AutoField(primary_key=True) Team_Name = models.CharField(max_length=100,) College = models.Ch...

Commit rails 2.3

Hi guy, I'm working to optimize my website in ror. The rails version is 2.3.5. So, I log mysql query. And I see what rails use transaction (begin commit) to create or update object in database. This method use my server resource and I would like to know how I can disable this commit ? I don't find a configuration for this thing. Thank...

django having multiple one many to many relations that references same model

i have a model that is having multiple many to many relation to another model it is as follows: class Match(models.Model): """Model docstring""" Match_Id = models.AutoField(primary_key=True) Team_one = models.ManyToManyField('Team',related_name='Team one',symmetrical=False,) Team_two = models.ManyToManyField('Team',related_nam...

Approach for representing command-line interface commands in code: Implementation of "database" where a query and result is obtained from proprietary CLI commands.

Problem Domain: I am working on a new revision of a Java application that connects via SSH to a proprietary, Linux-based platform's Command Line Interface (CLI). Everything on the platform that I would want to do or know is only available via CLI commands and stdout. One of the commands available retrieves information from an intern...

How do I save statuses as codes in db but map them to meaningful words in rails?

I need some help with this, please ... If I save a transaction status as a code in the db, but I want to translate them to meaningful names how do I do that? Is that even recommended? If no, what would be an alternative to that? For example: in the db the statuses are "S", "P", "A" and in the actual application I'd like to display: "Su...

How to properly access query-results created in background thread?

I want to execute a database query in a background thread. The OmniThread library will help me with all the thread stuff, but there is one thing I don't understand so far: Every thread needs a separate database connection. The background thread therefore creates the DB connection, creates the query and then executes it. Now I could acc...

Is there a downside by chosing ntext as datatype for all text columns?

Possible Duplicate: Are there any disadvantages to always using nvarchar(MAX)? Is there a general downside by chosing 'ntext' as column type instead of a type that contains chars but with a limited max size like 'char' or 'varchar'? I'm not sure whether a limited column size is applyable to all my colums. Therefore I would us...

converting database formats (mysql, ms access, ms excel, IBM DB2)

We need to a good tool that we can run from a script to automatically convert a (mysql, ms access or DB2) database to a (mysql, ms access, ms excel or DB2) database, while preserving the data types as much as possible (text, int, decimal, time...). Do you know of such a tool? I am looking for a solution, such as IBM Data Movement T...

SQLite-like alternative for MongoDB?

I'm looking for a document-oriented db with a Ruby API that has SQLite-like properties: self-contained, serverless, zero-configuration. Are there light alternatives to MongoDB or CouchDB? Is RDDB a possibility? If not, what are the best paths to walk then? ...

Can a Mock framework do this for me ?

Hello, I am a bit confused from wiki: "This means that a true mock... performing tests on the data passed into the method calls as arguments." I never used unit testing or mock framework. I thought unit tests are for automated tests so what are mock tests for? What I want is a object replacing my database I might use later but still ...

Thinking logically about a database structure: Adding 'tags' to things users post - A seperate table or...?

Hi everyone! I'm still beginning to get my head around this whole relational-database-thingymawhatsit. Anyway, I'm a PHP programmer so I can do all that shabang. I just need to think what would be the best method for this scenario... I'm developing a site (with CodeIgniter if that's any help) - a site where users can post content (thi...

Template Matching for relational database

I am trying to do the following: we are trying to design a fraud detection system for stock market. I know the Specification for the frauds (they are like templates). so I want to know if I can design a template, and find all records that match this template. Notice: I can't use the traditional queries cause the templates are complex ...

MS Access 2003 - Performing Calculations in a table's field with Transactions Table

One thing I want to do is build a personal database for myself at home to use a financial database (transaction log, checking/savings account tables, etc), and I want to do this mainly to learn more about developing databases. I am pretty familiary with MS Access, though not put to use in this context, but what I am really trying to lear...

What is the best way to store multiple date strings in Django?

I'm building a Django app that needs to store multiple selected dates for an event. The first thing that came to mind was build the event model: class Event(models.Model): title = models.CharField(max_length=200) creator = models.ForeignKey(User) modified = models.DateTimeField(auto_now=True, auto_now_add=False) ...

Scraping a phpbb forum

I want to know if it's possible to copy all the publicly available posts and data from one phpbb3 forum to a remote one without the database passwords and such, and if so, the simplest way to go about it. Details of the situation: We need to move the forums to a new and better place, but the guy who owns and operates the server where we...

if a database object is source controlled is it necessary to also note changes in the tombstone?

If I have a procedure definition that has been stored in source control, is it necessary or helpful to keep the 'tombstone' up to date as well? Here's what I mean by a 'tombstone': CREATE proc [dbo].[getCreditTransactions] AS /* 2001-02-12 jdoe : created proc 2003-04-15 kdoe : added handling for credit business rules */ etc...

Shuold I use not exists or join statement to filter out NULLs?

SELECT * FROM employees e WHERE NOT EXISTS ( SELECT name FROM eotm_dyn d WHERE d.employeeID = e.id ) And SELECT * FROM employees a LEFT JOIN eotm_dyn b on (a.joinfield=b.joinfield) WHERE b.name IS NULL Which is more efficient,some analysis? ...

How can I escape manually using the Database library with Kohana 3?

I need to quote a string a string in PHP using Kohana 3's Database library. In 2.3, all I had to do is $this->db->escape(). How can I do this in 3? I seem to remember seeing something like quote() when I was viewing the source, but for the life of me can I find it again. ...