Remote Network And System Administration Job In IT And Networking

Postgres - Help with performance issues using without using distinct / subquery

Find more Network And System Administration remote jobs posted recently Worldwide

Hi,

Were having a performance issue with postgres (11) and we need someone with expert skills to solve it!

***EDIT: BUDGET UPGRADED to $300 USD ***
***EDIT: BUDGET UPGRADED to $275 USD ***
***EDIT: BUDGET UPGRADED to $250 USD ***
***EDIT: Slow and Fast queries updated***

Problem:
Products table with about 60,000 rows and a Product Access table with about 33,000,000 rows. Neither of these tables as youll know are big by postgres standards. We have various indexes on the table already to alleviate the performance issues but nothing seems to help.

We need distinct rows for each product and all of the pagination needs to happen in postgres. There are a few order by clauses and where conditions that vary, depending on what the client is looking for.

Adding indexes for each of the order by statements is good, it allows for very quick results, since they can simply be walked. The problems arise when we try and get distinct values.

We have tried what everyone says online to do which is use a Distinct + Subquery. While the results are correct the performance is incredibly poor as all the results for the subquery are calculated (not returned) before performing the outer order by.

Since performance is really good when the index matches the order by exactly (about 1-2ms) we thought there could be some window function to remove duplicates, we just dont know how.

I will share the database schema and the only important tables. A full dump can be provided. We have also tried placing product right on products_display product access to avoid the join on a join, didnt make any appreciable difference.

$300 USD will be paid out instantly (to the first person) if a fix is included in your proposal, otherwise well make the hire and test that the solution works. For the query below the execution time should not exceed 100ms on any CPU within the last 5 years.

The slow query will give you the desired results. The first query is *close* to working, but needs to use CTE / Window Function or something to give the appropriate results fast enough. Any questions will be answered within 15 minutes.
About the recuiter
Member since Mar 14, 2020
Kunal Garud
from Oklahoma, United States

Open for hiringApply before - Jul 29, 2024

Work from Anywhere

40 hrs / week

Fixed Type

Remote Job

$191.59

Cost

Offer to work on this project closes in 21 days!
Are you interested in this Opportunity?

Looking for help? Checkout our video tutorial
How to search and apply for jobs

How to apply? Do you have more questions about the Job?
See frequently asked questions

Similar Projects

Set my postgresql for high availability

Hi! I need postgresql setup for high availability.
I need 10k and more requests per second.
And 3000 connections.
I

Php developer

I want php developer who can assist us in our office projects of school management and various other projects which require front end design. There will many projects. Some in php some in WordPress theme depending on clients requirements.

Database for Direct Marketing Efforts using MySql

I need to create a database, or some kind of way to track the direct marketing efforts of our business. We use a variety of methods to contact doctors offices (in-person visits, faxes, emails, phone calls). We want to track these efforts, as well as...read more

Database Administrator

I am looking for database creation for pricing medical claims based on different pricing parameters per client. I need query and report creating capabilities.