Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6200571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:23:31+00:00 2026-05-24T04:23:31+00:00

INSERT INTO contacts_lists (contact_id, list_id) SELECT contact_id, 110689 AS list_id FROM plain_contacts WHERE TRUE

  • 0
INSERT INTO contacts_lists (contact_id, list_id)
    SELECT contact_id, 110689 AS list_id 
    FROM plain_contacts 
    WHERE TRUE 
        AND is_print = TRUE 
        AND ( ( TRUE 
                AND country_id IN (231,39) 
                AND company_type_id IN (2,8,12,5,6,4,3,9,10,13,11,1,7) 
                AND is_broadcast = TRUE ) 
            OR ( TRUE 
                AND country_id IN (15,59,73,74,81,108,155,165,204,210,211,230) 
                AND company_type_id IN (2,8,12,5,6,4,3,9,10,13,11,1,7) 
                AND is_broadcast = TRUE ) 
            OR ( TRUE 
                AND country_id IN (230) 
                AND company_type_id IN (2,8,12,5,6,4,3,9,10,13,11,1,7) 
                AND is_broadcast = TRUE )) 
        AND (NOT EXISTS (
        SELECT title_id 
            FROM company_types_lists_titles 
            WHERE company_types_list_id = 92080) 
            OR title_id IN (
        SELECT title_id 
            FROM company_types_lists_titles 
            WHERE company_types_list_id = 92080)) 
        AND company_type_id = 2 
        AND country_id IN (
    SELECT country_id 
        FROM countries_lists 
        WHERE list_id = 110689)
        AND ((state_id IS NULL 
                OR country_id NOT IN (231,39) 
                OR state_id IN (
            SELECT state_id 
                FROM lists_states 
                WHERE list_id = 110689))
            OR zone_ids && ARRAY(
        SELECT zone_id 
            FROM lists_zones 
            WHERE list_id = 110689)
    )
        AND (NOT EXISTS (
        SELECT award_id 
            FROM company_types_lists_top_awards 
            WHERE company_types_list_id = 92080) 
            OR top_award_ids && ARRAY(
        SELECT award_id 
            FROM company_types_lists_top_awards 
            WHERE company_types_list_id = 92080))  

I have using postgresql which selects 30000 rows from various tables which takes lessthan a second to select data from various tables. But after selecting data which take more and more time to insert in another table. how to reduce the time insert. This is the query i have. In this the select query give nearly 30000 thousand records.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:23:33+00:00Added an answer on May 24, 2026 at 4:23 am

    take more and more time to insert

    That usually means you’re missing an index.


    Edit: now that you’ve posted the query… Definitely missing one or more indexes to speed up lookups during the insert. And you probably want to rewrite that huge select statement so as to reduce nesting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

INSERT INTO contacts_lists (contact_id, list_id) SELECT contact_id, 67544 FROM plain_contacts Here I want to
Possible Duplicate: syntax for COPY in postgresql INSERT INTO contacts_lists (contact_id, list_id) SELECT contact_id,
INSERT INTO options (owner, name, value, modified) SELECT owner, name, value, modified, @draft:=draft FROM
INSERT INTO table_a (col_tinyint, col_varchar) SELECT 0, distinct(col_other_varchar) COLLATE utf8_bin FROM table_b I want
INSERT INTO [Tasks] ([LoginName] ,[Type] ,[Filter] ,[Dictionary] ,[Description]) Select N'Anonymous',4,'SomeTable.targetcode in (select Code from
INSERT INTO files (fileUID, filename) WITH fileUIDS(fileUID) AS ( VALUES(1) UNION ALL SELECT fileUID+1
INSERT INTO item_quotation (item_id, quotation_id,name_searched,item_name,other_name,selling_price,discounted_price) SELECT DISTINCT I.item_id, . $quotation_id . ,T.item_name, I.name,I.other_name, INV.selling_price,
When trying this insert query: //insert into database $contact_id = db_insert('contact') ->fields(array( 'date_created' =>
I am currently working on an app, where I need to insert contacts into
INSERT INTO [Temp].[dbo].[Student] ([Fname], [Lname], [Gender]) VALUES (N'Aname', N'Alname', N'Male') GO This codes workes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.