I use PostgreSQL 13.5. There is recursive cte query: -- query1 with recursive cte AS ( SELECT * FROM ad_definition def WHERE def.ad_definition_id = 'BASIC' UNION ALL SELECT def.* FROM ad_definition def JOIN cte c ON c.ad_definition_id ...
databaseanswers.net Latest Questions
I have a users table with "bio" field and "n:n" relationship with itself via the followers table. So each user U can follow many other users. Problem: My user search query is super slow. Observations: All queries get the first 20 search ...
I’ve written a list below of what I am trying to achieve. I’m just unsure of the best way to store the data, my main considerations are the speed in which I can query the data and RAM usage when ...
I want to know: sum of rain (mm) sum of sunshine (hours) Probability (%) of a rainday with more than 0.5mm rain on weekends On the weekends (sa+so) between week 20 to 40 for the last 17years. I have 820k documents in 10min periods. The ...
how are you? I am currently using a for that goes through a table in my database, but I am recommended to use querys instead of for to have a better performance. How could I use a query to go ...
I’ve set up 2 VirtualBox machines with the same parameters. The first one with Debian 10 – PostgreSQL 11, the second with Debian 11 – PostgreSQL 13. The installation is only the base system + SSH server – no additional ...
I have a table with close to a billion records, and need to do a query on it with HAVING. Problem is, it’s very slow (about 15 minutes on decent hardware). Is there a way to speed it up? SELECT ((mean ...
I have a system with a large number of tables that contain historical data. Each table has a ts_from and ts_to column which are of type timestamptz. These represent the time period in which the data for a particular row ...
I am having below query which selects SUM of AAD_00TO30 columns depending upon some conditions. The query executes in 1 sec when I remove below condition, but it takes more than a min when same condition is included. Can someone please suggest ...
I have a huge mysqldump file (~700GB) that I want to restore on a different server. For the first GBs, the import is quite fast with some MB/s, but after some GB of data, the speed drops to something between ...