-5
votes
0answers
88 views

Convert PHP MySQLi Prepared Statement to PostgreSQL Prepared Statement [on hold]

I've searched the net (php and postgresql docs) and some books and am confused about the following when converting php mysqli prepared statements to postgresql prepared statements: What placeholders ...
0
votes
1answer
36 views

RDBMS: RAID vs Table Partitioning for a Single Huge Table

We have a single huge table around 10 TBs in which each row is approximately 10 KB. The primary key's type is BIGINT and it is uniformly distributed. The server has 40 GBs of RAM, two 4-core Xeon ...
0
votes
1answer
23 views

What algorithm or pattern to use to check what rows in what tables will be cascade deleted in mysql/pgsql?

So the question - I have a lot of tables in database and almost all of them have on delete cascade. What is the best way to inform user what will be deleted in entire database if he deletes one ...
0
votes
1answer
24 views

Rails table indexes are not foreign keys in database as expected - why?

I have created tables for user and attendance (Users, Attendances) and all is good. A user has many attendances and an attendance belongs to user. The code works and Rails works but there is one big ...
0
votes
1answer
70 views

Which database to use with Django and Python 3? [closed]

I'm writing my first application with Django and Python 3.3.3. I've always used MySQL for others projects, but it seems to have some problems with Python 3.X and MySQL : At the time of writing, ...
0
votes
0answers
15 views

How to migrate Views from mysql to postgresql?

I migrated from mysql to postgresql recently.Problem is tables got migrated successfully but i failed to migrate views in my database.How to migrate Views from mysql to postgresql?
2
votes
1answer
43 views

Concept design for a MMO java engine

We are building a HTML5 MMO that will leverage AJAX calls to a REST API written in Python for actions ( buy, sell, build, trade, send , attack). Our second part of this project is a Java Server that ...
0
votes
1answer
34 views

if no file upload, file id in database should be: placeholder.gif

i have a form where you can put an image uploade, which is optional. with this script at the moment it writes upload/timestamp into my database. but i need to replace that with a placeholder if no ...
0
votes
0answers
22 views

Get last recursive in mysql query

Let's say I have a table with 2 column. id and id_father. 1 null 2 1 3 2 How can I know, with a query ( in pgsql ) the id of the father ? I mean, If I look for the id 3. I will know that the ...
1
vote
1answer
41 views

SQL query to find counts of joined table rows as summary for each row

I have a table of widgets that looks like: id (integer) referrer (varchar(255)) width (integer) height (integer) ... and some others. I also have a table of events that look like: id (integer) ...
1
vote
2answers
42 views

Order of composite where clause (MySQL, Postgres)

I have a table t with columns a int, b int, c int; composite index i (b, c). I fetch some data with following query: select * from t where c = 1 and b = 2; So the question is: will MySQL and ...
1
vote
3answers
55 views

Reverse index for multiple keywords search

I am looking for an architectural solution to the following problem: General description of problem I have lots of distinct data entities (approximately 15 millions). Every entity is associated with ...
0
votes
2answers
40 views

Creating primary key on existing table sql

I have a table of the following form: create table tab1(i1 int, i2 character varying); I want to make i1 as the primary key. However my problem is i1 column contains duplicate rows. In order to ...
0
votes
2answers
50 views

Multiple applications accessing the same data

So my team is developing an API in PHP . My main concern is what happen 2 people call to update the same row. So if one API call will do a read then process info then write, what happens if another ...
1
vote
5answers
93 views

Thoughts on using email addresses as primary key [duplicate]

What are practices about using email addresses as the primary key? Should I avoid it and use an auto incremented ID number instead or is the engine able to handle it just as well? MySQL database but ...
0
votes
2answers
42 views

postgresql rails price range filter with between

I have the following array of price ranges how can I perform a query to find the price range between these using and operator This is the array I have ["0-1000", "5001_15000", "15001_25000"] ...
0
votes
1answer
18 views

Easily viewing postgresql and mysql results that are too wide for the terminal

I regularly use postgresql and mysql in the mac terminal, and I find that results that have a large number of columns become very difficult to interpret because the entire table becomes a mess. I have ...
0
votes
1answer
45 views

SymmetricDS: real time synchronisation of MySQL with PostgreSQL

I need to move a huge system from MySQL to PostgreSQL. This cannot be done in one go, which is why I need a robust (real time or near real time) data bi-directional synchronisation solution between ...
1
vote
0answers
21 views

How to write an event trigger which send alerts to a JMS Queue

Is there any example where, we can trigger an event to send messages to JMS Queue when a table is updated/inserted ect for MYSQL/Postgre?
0
votes
1answer
38 views

get all unique records and their corresponding column

Is it possible to get all unique records as well as their corresponding column in a database? something like: SELECT DISTINCT * FROM table_name ?where? I want to get all unique records with their ...
-2
votes
2answers
36 views

How to import PostgreSQL into MySQL database?

I have dumped a PostgreSQL database and I would need it to a MySQL as we migrate our project from Heroku to Amazon EC2, where is MySQL. It's quite a long time when I was doing something similar like ...
0
votes
0answers
18 views

How to fetch Heroku database and import it into a project on Amazon EC2?

On Heroku is PostgreSQL database, on EC2 MySQL. I downloaded database from Heroku through the addon called pgbackups, but when I open the downloaded file, the output is like 5047 444d 5001 0c00 0408 ...
-2
votes
1answer
28 views

Postgis functionalities in Microsoft SQL Server

I'm using Postgresql 8.4, Postgis 1.5 for My GIS works. Planning to change my Database to Microsoft SQL Server 2012. Can we use all the Postgis functionalities in Microsoft SQL Server 2012. Please ...
1
vote
3answers
79 views

aggregation and statistical functions on NOSQL databases

Using SQL databases, it is easy to do statistical / aggregate functions like covariance, standard deviation, kurtosis, skewness, deviations, means and medians, summation and product etc, without ...
0
votes
1answer
63 views

Add a subquery to SELECT statement that depends on the first column?

Is there a way I can write this query in a way to get the result of my sub query compared with my category_id. SELECT category_id, count(id) as TOTAL COUNT, (select count(*) from products where ...
0
votes
2answers
39 views

Rails mistakenly saying to add postgres to bundle

I have a rails project that uses mysql (and has so successfully in the past). However, after upgrading my postgres installation, this rails project is throwing the adapter not installed error: ...
1
vote
1answer
39 views

How do I preserve logical groupings while sorting in SQL?

I have two tables which are related in a parent-child relationship Sale sale_id | customer_name SaleItem item_id | sale_id | item_type Each Sale record has one or more corresponding SaleItem ...
1
vote
2answers
43 views

Activerecord ORDER BY FIELD

I am trying to do a "ORDER BY FIELD" in active record. I know that i can do it with MySQL but i am trying to keep my app agnostic and follow best practice. my production db is PostgreSQL the MySQL ...
0
votes
2answers
49 views

Read Lock in Ruby on Rails

There doesn't seem to be a built-in way to acquire a read lock in Rails (for a table). I know these are not typically ideal, but my use case seems to require one: There are a limited number of ...
0
votes
2answers
40 views

MySQL query fails in PostgreSQL

Using this query: users = User.where('confirmed_at is NULL AND confirmation_sent_at <= DATE_SUB(NOW(), INTERVAL ? days)', 1) In mysql goes okay but in Postgresql it fails with: ...
1
vote
3answers
55 views

Oracle to PostgreSQL query converter Possible?

I am thinking to write a converter that takes any oracle query and return Postgresql format of the query assuming table and columns are same. what I do right now I do timely conversions so I have ...
-3
votes
2answers
36 views

How the maximum value of Bytes is calculated?

Can any one tell me how the range of the data types are calculated? For example, in MySQL or PostgreSQL where we have smallint, integer and bigint, the range of smallint is from -32768 or +32767. How ...
2
votes
3answers
81 views

Postgresql select people you may know orderded by number of mutual friends

I'm building a social network, and I want my members to be able to easily find new friends. Just like in Facebook, I want to suggest them some people they may know by the number of mutual friends they ...
0
votes
2answers
29 views

Rank base on a column in one table

I have a simple table User with two attribute ID and AGE Now I want to get a 'rank' result base on AGE User Table ID AGE 0 23 1 35 2 30 3 52 4 35 5 23 ...
0
votes
1answer
41 views

MySQL/PostgreSQL record search: any alternative to LIKE?

I'm implementing a search system in my system and i'm curious about the usage of LIKE. Many websites and books "crucify" the usage of LIKE. But, what's the proper alternative? I really don't want to ...
1
vote
1answer
50 views

How do I selectively disable a remote db connection during rspec tests?

I have a configuration where, in addition to the local postgresql database, my Rails app also accesses a remote AWS database. My problem is that, even in tests that don't involve the remote database, ...
0
votes
2answers
51 views

Sql query to find subset of a given table

Given this table: http://www.w3schools.com/sql/trysql.asp?filename=trysql_func_sum How will I generate list of OrderIds where sum of quantity is at most 90. How do I express the same in SQL ? There ...
1
vote
2answers
45 views

Which database engine is most suitable to handle array values? [closed]

The often seen use case is when one store a list of tag to an item tag: [123,233,...], and the result should be query-able like "getting all rows with tag 233". Seems like the most advocated approach ...
0
votes
1answer
35 views

Using libpqxx for to store data in bulk OR how to use COPY statement in libpqxx

To insert bulk data/populate a database in PostgreSQL, the fastest way would be to use COPY. Source I have to populate a database. Right now I am getting write speeds as low as 100-200 per second. ...
0
votes
2answers
63 views

MySQL to PostgreSQL conversion and data synchronisation [on hold]

I have a relatively large MySQL database (over 300 tables) which I desperately need to convert to PostgreSQL and synchronise data between the two databases if not real time then something close to it. ...
-3
votes
1answer
40 views

Please explain ST_GeomFromText parameters

I am having trouble understanding ST_GeomFromText. It looks like there are 3 sets of 2 numbers. Why is that? Wouldn't coordinates just consist of a latitude and longitude? Here is an example from ...
0
votes
1answer
90 views

Porting a MySQL password query to Postgres

I have a portion of a MySQL query which is designed to save a password using SHA512-CRYPT: SELECT ENCRYPT('firstpassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))) I need to port the application ...
0
votes
1answer
55 views

how to generate subsets from a query in postgres?

I need subsets of tuples for a given query. For example , if I need to find list of all employees who are older than 25 and limit that to atmost 5. how do I generate various subsets for the same ? ...
1
vote
1answer
47 views

SQL - find the closest pair of numbers to a provided pair

I have a DB Table where I would like to select the entry which is the closest match to a pair of provided values, whether positive or negative. Provided values: num1 = 2.5, num2 = 10.2 Compared ...
0
votes
1answer
45 views

Clojure QL : running plain SQL queries

are there any ways to perform the following queries in clojureql ? : insert into table1(id, name, age) select id, name, age from table2 create table t1 (id int, name varchar(50), age varchar(100)); ...
1
vote
2answers
48 views

What best way to include dll for tdbc::mysql&tdbc::postgres under windows starpack?

Packages tdbc::mysql and tdbc::postgresql require dll libmysql.dll and libpq.dll somewere in PATH. What best way to include this dlls into single starpack? For now I'm using following pkgIndex.tcl: ...
0
votes
1answer
58 views

Postgresql function If condition then run query else stop

I need some help with the following postgres functionality I have the following table with the columns: array, array_length I initially have a few arrays in and then I run a query(actually a set ...
1
vote
1answer
64 views

SQL query for calculating percentage completion of a survey

Here I have a survey and survey has many questions.Question has many answers.This is very basic relation of my survey.Every question is having a 'sequence number'.This 'sequence number' is used for ...
0
votes
1answer
30 views

Duplicating PostgreSQL database on one server to MySQL database on another server

I have a PostgreSQL database with 4-5 tables (some of those have more than 20 million rows). i have to replicate this entire database onto another machine. However, there I have MySQL (and for some ...
0
votes
1answer
59 views

Adodb using php with PostgreSQL

I have database name "TestDB" and under that I have table called "User". Above TestDB database and User table have been created in both mysql and postgres. I have written the following code. it is ...

15 30 50 per page