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

  • Home
  • SEARCH
  • 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 8476655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:14:23+00:00 2026-06-10T18:14:23+00:00

I am using PostgreSQL database. Having a table named metadatavalue with structure is as

  • 0

I am using PostgreSQL database.

Having a table named metadatavalue with structure is as below:

metadatavalue_id    integer  Primary Key Auto Increment
metadta_field_id    integer  Foreign Key
text_Value      varchar
text_lang       varchar
place           integer

When anything gets submitted or added an item with almost 25 metadata fields
is created.

The metadatavalue table already contains around

One Hundred Fifty Thousand(150000) records.

I am implementing an auto complete feature for a field let say “Author”
which is stored as metadata_field_id in the table.

When I query the table on PgSQL prompt, it takes almost 1 or 2 seconds to return the result.

QUERY:

SELECT metadatavalue.text_value AS author, count(metadatavalue.text_value) AS count
   FROM metadatavalue
  WHERE (metadatavalue.metadata_field_id IN ( SELECT metadatafieldregistry.metadata_field_id
           FROM metadatafieldregistry
          WHERE metadatavalue.text_value LIKE 'Pra%' AND metadatafieldregistry.metadata_schema_id = 1 AND metadatafieldregistry.element::text = 'contributor'::text))
  GROUP BY metadatavalue.text_value;

As its for auto complete the query might run 4-5 times when users enters value.

So, I am thinking to implement LUCENE based search.

In which,At First creating an index from back end and then on each new item
creation running a thread to index the new item.

I want to know that whether Apache Lucene would be better choice or
SQL can be optimized.

EDIT:
There is another table which contains metadata fields and it is used as Foreign Key (metadatafieldregistry.metadata_field_id) in metadatavalue table for the value.

  • 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-06-10T18:14:24+00:00Added an answer on June 10, 2026 at 6:14 pm

    I would say any database will handle at least a million rows gracefully if proper indexing is done, there is no reason for you to get into Lucene or Solr which will introduce you to new tasks like synchronization of your indexes with most current state of the DB.

    Also, Lucene or Solr are very great for free text searching. This means if you search for “Bob Marley” on your Lucene “documents” then you will get all the document which has “Bob Marley”, “Marley Bob” or only “Bob” and only “Marley” or even “Bob…lot of text…Marley”. So using Lucene also depends on what kind of use cases you are trying to cover.

    From the query you have shown I feel you will get good performance if you index metadatavalue.text_value metadatafieldregistry.metadata_schema_id and metadatafieldregistry.element columns. Also try converting your query to a join rather then an in query.

    Thanks

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

Sidebar

Related Questions

I've been storing dates in a PostgreSQL 8.3 database table using a query resembling
I am using PostgreSQL database. I have the data like below. id name1 name2
I have a postgresql database and am using it for a project which handles
I am using pgAdmin version 1.14.3. PostgreSQL database version is 9.1. I got all
I was using Mysql database before and decided to switch to Postgresql and now,
(I am using PostgreSQL) I have a table which stores transactions to an account.
I am using a PostgreSQL database. I have one select query: select userid, name,
I write an application based on an already existing database (postgreSQL) using JPA and
If you wanted to manipulate the data in a table in a postgresql database
I am working on a Java implementation for temporal aggregation using a PostgreSQL database.

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.