-2
votes
0answers
28 views

Why PostgreSQL is more feature rich than MySQL with very smaller codebase? [on hold]

Several DBMS comparison articles have stated that PostgreSQL is more feature rich than MySQL. For instance, see this and this. I can not provide more links due to Stackoverflow limitation. But today ...
0
votes
3answers
44 views

SQL Deleting from a join table not working

The below is returning a syntax error issue. Having searched thoroughly online, I cannot see why. Any ideas? delete Tracks ...
2
votes
1answer
24 views

Does WITH create a temporary table and if so can it be used in multiple threads safely?

In Postgres, is a WITH clause creating a temporary table and if so can it be used in multiple threads safely ? I.e. WITH x below, would this be ok if the CTE running in multiple different threads? ...
1
vote
1answer
31 views

How can one atomically UPDATE a relation, receiving a set of tuples joined with another relation as a result?

I have the following transaction: BEGIN; SELECT t1.a, t2.b FROM table1 t1 INNER JOIN table2 t2 ON (t1.c = t2.c) WHERE t1.cond; UPDATE table1 SET d = 'Value' WHERE ...
0
votes
4answers
47 views

optimize query sql for messenger

I have a messages table with 5 millions rows, I want to retrieve the last 10 rows of two users conversation +---------------------------------------------------------------+ | ...
2
votes
1answer
54 views

Slow postgres query with multiple joins to same table

The following query is running very slowly for me: SELECT r.comp,b.comp,n.comp FROM paths AS p INNER JOIN comps AS r ON (p.root=r.id) INNER JOIN comps AS b ON (p.base=b.id) INNER JOIN comps ...
12
votes
4answers
7k views

Reset auto increment counter in postgres

I would like to force the auto increment field of a table to some value, I tried with this: ALTER TABLE product AUTO_INCREMENT = 1453 AND ALTER SEQUENCE product RESTART WITH 1453; ERROR: ...
0
votes
1answer
9 views

Named Native Query, execute update statement

Can we create update statement using @NamedNativeQuery, @Entity @Table(schema = "public", name = "conversion_checker") @NamedNativeQueries({ @NamedNativeQuery(name="updateExpireStatus", ...
1
vote
1answer
29 views

PostgreSQL columns to rows with no explicilty specifying column names / columns

I would like to know is there any way to do unpivot (turn columns to rows) data in PostgreSQL. For example, if I have a table like: ID Name Age 1 Alice 16 2 Bob 21 3 Carl ...
8
votes
4answers
97 views

When does a SELECT query begin to return rows?

Suppose the following query: SELECT * FROM table; Will the DBMS give me the first row as soon as it fetched it or will it first fetch all the rows (save them in some kind of buffer) and then give ...
5
votes
2answers
519 views

Decode equivalent in postgres

There is no equivalent to the Oracle decode Function In Postgres.Is there anyone who wrote decode as a Function?
1
vote
1answer
29 views

How can I add the array to the array of arrays in SQL (Postgres)

I have a table with an attribute that is an array of arrays. Example: a={{1,A, 1},{A,B,C},{45,46,47}} I want to add an array to the array "a". Example: new_array={Z,T} to "a" in order to have ...
2
votes
1answer
34 views

Detect trends in time series

I have a psql database with time series values for various stocks. I want to find, if the stock value increased by lets say 50% in last 45 days. I want to detect such sudden changes in the curve. ...
3
votes
2answers
35 views

How to find the need of materials from nested estimates in Postgres

Product estimates contain sub-products. Sub-products can contain also sub-products etc. Finally tree leafs contians materials. Maximum nesting level is 10. Orders contain also products, sub-products ...
1
vote
5answers
4k views

How can I store the result of a SQL query in a CSV file using Squirrel?

Version 3.0.3. It's a fairly large result-set, around 3 million rows.

1 2 3 4 5 329
15 30 50 per page