database

Need some serious help with self join issue.

Well as you may know, you cannot index a view with a self join. Well actually even two joins of the same table, even if it's not technically a self join. A couple of guys from microsoft came up with a work around. But it's so complicated I don't understand it!!! The solution to the problem is here: http://jmkehayias.blogspot.com/2008/12...

SQL Server architecture guidance

Hi, We are designing a new version of our existing product on a new schema. Its an internal web application with possibly 100 concurrent users (max)This will run on a SQL Server 2008 database. On of the discussion items recently is whether we should have a single database of split the database for performance reasons across 2 separate ...

SQL - Optimizing complex paged search querys

Hi, I'm currently developing a stored procedure for a complex search in a big database. Because there are many thousand entries, that could be returned I want to use paging. Although it is working, I think it's too slow. I read a lot of posts and articles regarding pagination of SQL queries and optimizing performance. But most 'optimizat...

When optimizing database queries, what exactly is the relationship between number of queries and size of queries?

To optimize application speed, everyone always advises to minimize the number of queries an application makes to the database, consolidating them into fewer queries that retrieve more wherever possible. However, this also always comes with the caution that data transferred is still data transferred, and just because you are making fewer...

in-memory database in Python

I'm doing some queries in Python on a large database to get some stats out of the database. I want these stats to be in-memory so other programs can use them without going to a database. I was thinking of how to structure them, and after trying to set up some complicated nested dictionaries, I realized that a good representation would ...

Multilangual website using ASP and a database

i want to consult about something i do. my website has 3 languages. Hebrew (main), english and russian. i am using a database having a table with the fields: ID, fieldName, 1, 2, 3. where 1 2 3 are the languages. upon entering the website language 1 (hebrew) is chosen automaticly until you choose another. and saved as a session("curre...

get value from MySQL database with PHP

$from = $_POST['from']; $to = $_POST['to']; $message = $_POST['message']; $query = "SELECT * FROM Users WHERE `user_name` = '$from' LIMIT 1"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $fromID = $row['user_id']; } I'm trying to have $formID be the user_id for a user in my database. Eac...

help with delete where not in query

I have a lookup table (##lookup). I know it's bad design because I'm duplicating data, but it speeds up my queries tremendously. I have a query that populates this table insert into ##lookup select distinct col1,col2,... from table1...join...etc... I would like to simulate this behavior: delete from ##lookup insert into ##lookup sele...

Best practice how to store HTML in a database column

I have an application that modifies a table dynamically, think spreadsheet), then upon saving the form (which the table is part of) ,I store that changed table (with user modifications) in a database column named html_Spreadhseet,along with the rest of the form data. right now I'm just storing the html in a plain text format with basic ...

Connecting a midlet with a database

Hello, I am doing a project in Java for mobile devices using the NetBeans IDE. I need to connect the midlet with a local database. I've tried in many ways but do not get anything. Does anyone know how? Thanks ...

When are database triggers bad?

Possible Duplicate: Are database triggers evil? There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. ...

What is the fastest findByName query with hibernate?

I am sure I can improve the performance of the following findByName query of hibernate: public List<User> findByName(String name) { session.createCriteria(User.class).add(Restrictions.eq("name", name)).list(); } The bottleneck is that findByName method and I cannot use the id instead. In my case I know that the name is unique but a...

Entity Framework 4 "Generate Database from Model" to SQLEXPRESS mdf results in "Could not locate entry in sysdatabases for database"

I'm using Visual Studio 2010 RTM. I want to do model-first, so I started a new MVC app and added a new blank edmx. Created a few entities. No problem. Then I "Generate Database from Model", and allow the dialog to create a new database for me, which it does successfully as 'mydatabase.mdf' in the app's App_Data directory. Then I open th...

How do I populate a table from an Excel Spreadsheet in Rails?

I have a simple 4-column Excel spreadsheet that matches universities to their ID codes for lookup purposes. The file is pretty big (300k). I need to come up with a way to turn this data into a populated table in my Rails app. The catch is that this is a document that is updated now and then, so it can't just be a one-time solution. I...

Non-normalized association with legacy tables in Rails and ActiveRecord

I am building a Rails application accessing a legacy system. The data model contains Customers which can have one or more Subscriptions. A Subscription always belong to one and only one Customer. Though not needed, this association is represented through a join table "subscribes", which do not have an id column: Column | Type...

need a button that calls a php function

I need to have a button that calls a php function to resort displayed data from the db. How the heck do I do this? I just found out that because php is server side this sucks. So any help please? ...

Django ORM and PostgreSQL connection limits

I'm running a Django project on Postgresql 8.1.21 (using Django 1.1.1, Python2.5, psycopg2, Apache2 with mod_wsgi 3.2). We've recently encountered this lovely error: OperationalError: FATAL: connection limit exceeded for non-superusers I'm not the first person to run up against this. There's a lot of discussion about this error, speci...

Use the repository pattern when using PLINQO generated data?

I'm "upgrading" an MVC app. Previously, the DAL was a part of the Model, as a series of repositories (based on the entity name) using standard LINQ to SQL queries. Now, it's a separate project and is generated using PLINQO. Since PLINQO generates query extensions based on the properties of the entity, I started using them directly in my...

Create MySQL database with default InnoDB tables?

I've been working on writing a SQL statement to create a MySQL database with several default options, including default character set and default collate. Is it possible to add syntax to make the default engine type for tables in this database to be InnoDB? I've been looking through the MySQL manual for v.5.1 and I've found the statem...

To create new DB connection or not?

I'm running a cron job (every 15 minutes) which takes about a minute to execute. It makes lots of API calls and stores data to the database. Right now I create a mysql connection at the beginning and use the same connection through out the code. Most of the time is spent making the API calls. Will it be more efficient to create a new...