Tagged Questions
23
votes
13answers
2k views
How to filter SQL results in a has-many-through relation
Assuming I have the tables student, club, and student_club:
student {
id
name
}
club {
id
name
}
student_club {
student_id
club_id
}
I want to know how to find all students ...
155
votes
7answers
50k views
Comparison of full text search engine - Lucene, Sphinx, Postgresql, MySQL?
I'm building a Django site and I am looking for a search engine.
A few candidates:
Lucene/Lucene with Compass/Solr
Sphinx
Postgresql built-in full text search
MySQl built-in full text search
...
30
votes
9answers
13k views
postgreSQL group by different from mysql?
I've been migrating some of my mySQL queries to postgreSQL to use Heroku... most of my queries work fine, but I keep having a similar recurring error when I use group by:
ERROR: column "XYZ" must ...
152
votes
25answers
6k views
What resources exist for Database performance-tuning?
What good resources exist for understanding database tuning on the major engines and advancing your knowledge in that area?
The idea of this question is to collect the shed load of resources that ...
154
votes
15answers
17k views
Would you recommend PostgreSQL over MySQL? [closed]
We are currently working with JavaEE and MySQL 5 in our company, but we have some queries, especially delete queries that take > 10 min to execute. We consider to switch to PostgreSQL.
What are the ...
2
votes
1answer
606 views
Rails - Postgres does not re-use deleted ids but MySql does?
I'm moving from MySql to Postgres, and I noticed that when you delete rows from MySql, the unique ids for those rows are re-used when you make new ones. With Postgres, if you create rows, and delete ...
68
votes
11answers
36k views
MySQL vs PostgreSQL for Web Applications [closed]
I am working on a web application using Python (Django) and would like to know whether MySQL or PostgreSQL would be better when deploying for production.
In one podcast Joel said that he had some ...
9
votes
7answers
5k views
Simulating MySQL's ORDER BY FIELD() in Postgresql
Just trying out Postgresql for the first time, coming from MySQL. In our Rails application we have a couple of locations with SQL like so:
SELECT * FROM `currency_codes` ORDER BY FIELD(code, 'GBP', ...
6
votes
13answers
11k views
SQL ORDER BY the 'IN' value list
I have a simple SQL query (in PostgreSQL 8.3) that grabs a bunch of comments. I've composed a bunch of ids before-hand and that gets fed into the WHERE IN clause like so...
SELECT * FROM "comments" ...
7
votes
1answer
1k views
generate_series() equivalent in MySQL
I need to do a query and join with all days of the year but in my db there isn't a calendar table.
After google-ing I found generate_series() in PostgreSQL. Does MySQL have anything similar?
My ...
2
votes
4answers
8k views
How to bind SQL variables in Php?
How to bind SQL variables in Php?
I want to bind variables instead of just building SQL strings.
Anyway to do this in Php?
either MySQL or PostgreSQL answers would help.
Thanks
43
votes
11answers
28k views
How do you write a case insensitive query for both MySQL and Postgres?
I'm running a MySQL database locally for development, but deploying to Heroku which uses Postgres. Heroku handles almost everything, but my case-insensitive Like statements become case sensitive. I ...
31
votes
9answers
25k views
How do I UPDATE a row in a table or INSERT it if it doesn't exist?
I have the following table of counters:
CREATE TABLE cache (
key text PRIMARY KEY,
generation int
);
I would like to increment one of the counters, or set it to zero if the corresponding ...
10
votes
4answers
15k views
Application to reverse engineer MySQL & PostgreSQL DB?
Is there an application to reverse engineer an existing database in mysql and/or postgre?
I'm interested in obtaining the DB diagram from an existing one, similar as it can be done in MSSQL Server
11
votes
7answers
4k views
How different is PostgreSQL to MySQL?
I've been asked to support and take on a PostgreSQL app, but am a MySQL guy - is this a realistic task?