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 9111293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:28:11+00:00 2026-06-17T03:28:11+00:00

After I get excellent results with converting data to_timestamp and to_number from VB.NET I

  • 0

After I get excellent results with converting data “to_timestamp” and “to_number” from VB.NET I am wondering if PostgreSQL have possibility to query table indexes by array of integers from .NET?

Say, I have array filled with (1, 3, 5, 6, 9).
Is here any possibility that PostgreSQL return rows with data from those indexes to “odbc.reader”?
That would be much faster than looping and querying 5 times like I do now.

Something like this:

SELECT myindexes, myname, myadress from mytable WHERE myindexes IS IN ARRAY 

If this is possible how a simple query should look like?

  • 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-17T03:28:13+00:00Added an answer on June 17, 2026 at 3:28 am

    That’s possible.

    ANY

    SELECT myindex, myname, myadress
    FROM   mytable
    WHERE  myindex = ANY ($my_array)
    

    Example with integer-array:

    ...
    WHERE  myindex = ANY ('{1,3,5,6,9}'::int[])
    

    Details about ANY in the manual.

    IN

    There is also the SQL IN() expression for the same purpose.
    PostgreSQl in its current implementation transforms that to = ANY (array) internally prior to execution, so it’s conceivably a bit slower.


    Examples for joining to a long list (as per comment):

    JOIN to VALUES expression

    WITH x(myindex) AS (
        VALUES
        (1),(3),(5),(6),(9)
        )
    SELECT myindex, myname, myadress
    FROM   mytable
    JOIN   x USING (myindex)
    

    I am using a CTE in the example (which is optional, could be a sub-query as well). You need PostgreSQL 8.4 of later for that.
    The manual about VALUES.

    JOIN to unnested array

    Or you could unnest() an array and JOIN to it:

    SELECT myindex, myname, myadress
    FROM   mytable
    JOIN  (SELECT unnest('{1,3,5,6,9}'::int[]) AS myindex) x USING (myindex)
    

    Each of these methods is far superior in performance to running a separate query per value.

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

Sidebar

Related Questions

I have a javascript/jQuery block as a callback after $.get function: function myCallBack(data, textStatus)
After excellent advice I defined a struct, filled it with data read from a
After I get the Auth token from https://www.google.com/accounts/ClientLogin do I need to send 1
I am trying to get the best from the excellent open source Mind Map
I need to get some data from X509 certificate. If I open a certificate
I have a program which opens many Excel workbooks and merges data from all
After trying to get the mercurial repository explorer setup on my shared hosting with
This class hangs at Future.get() method after executing ExecutorService.shutdownNow() called. I don't know what
Is it possible to get list after Session.Close as below? var bundles = session.Linq<Bundle>();
I am trying to get the value of javascript pop-up after using file_get_contents .

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.