Hey, I am having troubles to find some explanation...
# support
n
Hey, I am having troubles to find some explanation on why Rudderstack is running very operation on the Postgres warehouse. The following seems to maxout the throughput and take hours to complete. Is there any good resource to understand and/or troubleshoot this behaviour?
Copy code
CREATE TABLE app.rudder_staging_users_fad5929fc99a471b9fc3bd66a5b5d70c AS (
  SELECT 
    DISTINCT * 
  FROM 
    (
      SELECT 
        x.id, 
        case when (
          select 
            true
        ) then (
          select 
            "utm_medium" 
          from 
            "app"."rudder_staging_users_identifies_union_52d79f0f71fd4316b294aaab2316de25" as staging_table 
          where 
            x.id = staging_table.id 
            and "utm_medium" is not null 
          order by 
            received_at desc 
          limit 
            1
        ) end as "utm_medium", 
        case when (
          select 
            true
        ) then (
          select 
            "context_traits_shop_id" 
          from 
            "app"."rudder_staging_users_identifies_union_52d79f0f71fd4316b294aaab2316de25" as staging_table 
          where 
            x.id = staging_table.id 
            and "context_traits_shop_id" is not null 
          order by 
            received_at desc 
          limit 
            1
        ) end as "context_traits_shop_id", 
        case when (
          select 
            true
        ) then (
          select 
            "context_source_id" 
          from 
            "app"."rudder_staging_users_identifies_union_52d79f0f71fd4316b294aaab231
Any news?
@quiet-wolf-72320 I see that most of the support requests are answered but mine is not. Any idea, is there someone on it? Thanks in advance.
q
@nutritious-park-97351 Apologies if this was not answered earlier. Can you help us with more details. What are you trying to achieve here, Where is this query being executed? What source/destinations you have setup?
n
@quiet-wolf-72320 We have 1 source (Flutter) ingesting into 1 destination (Postgres). the ingestion works but looking at the queries see the table above of queries being run by Rudderstack and taking looooong time. The SQL above is one sample queries. What else do you need?
@quiet-wolf-72320 is there something else I can do?
Has anyone any idea please ↑?
q
@nutritious-park-97351 I have forwarded your query to eng team to take a look. Will hear back soon
a
@nutritious-park-97351 Can u share postgres configurations? Like mem, cpu?
n
@average-tailor-86667 @quiet-wolf-72320 Thanks. We have 6 vcpu and 8go of ram, 250mo/s max through put and 3000 IOPS (aws gp3). Aside in the psql config:
Copy code
effective_io_concurrency = 100
    shared_buffers = 1500MB
    work_mem = 25MB
👍 1
@average-tailor-86667 @quiet-wolf-72320 any news?
It is getting messier :
@average-tailor-86667 @quiet-wolf-72320 can I hear/get back?
a
Hi @nutritious-park-97351, we are discussing on improving the query.
Problem here is in order to preserve all the traits, we are scanning the table multiple times per column to get the non null value.
n
Okay, I already understand this is expected. Thanks for the acknowledgment. Is not the issue the absence for proper indexing for that query? It seems to load all the data without taking shortcuts? @average-tailor-86667
a
Yeah, problem is in order to find non null traits it is scanning multiple times.
n
@average-tailor-86667 any news? This makes rudderstack unusable with Postgres, and should be stated clearly in the documentation.
l
@average-tailor-86667 can we get back to Teo?
a
@nutritious-park-97351 We can disable loading to users table if it is not being used using this.
@nutritious-park-97351 We can try add index to the id columns for the users table.