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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:18:20+00:00 2026-05-17T20:18:20+00:00

Im new to Postgres and I dont know how to translate this MySQL query

  • 0

Im new to Postgres and I dont know how to translate this MySQL query to postgres:

SELECT pictures.id, MATCH (title, cached_tag_list) AGAINST ('phrase') AS score FROM pictures WHERE MATCH (title, cached_tag_list) AGAINST ('phrase') ORDER BY score DESC;
  • 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-17T20:18:21+00:00Added an answer on May 17, 2026 at 8:18 pm

    The Postgres fulltext search is a little different from the MySQL fulltext search. It has a lot more options but can be a bit more difficult to get working the way you like it.

    This document tells you how to rank your search results, but I strongly recommend you read the entire fulltext section from the manual to get an idea about what you can do with it: http://www.postgresql.org/docs/current/interactive/textsearch-controls.html#TEXTSEARCH-RANKING

    Basically, the equivalent of your query would be this:

    SELECT pictures.id, ts_rank_cd(textsearch, 'phrase') AS score
    FROM pictures
    ORDER BY score DESC
    

    As you can see, this uses textsearch which is something you will have to define yourself. For the short version, read: http://www.postgresql.org/docs/current/interactive/textsearch-tables.html

    The query is essentially very simple:

    SELECT pictures.id, ts_rank_cd(to_tsvector('english', pictures.title), 'phrase') AS score
    FROM pictures
    ORDER BY score DESC
    

    But I would strongly recommend adding indexes aswell:

    CREATE INDEX pictures_title ON pictures USING gin(to_tsvector('english', title));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to conditional statements within postgres. I have the following statement SELECT IF
I have a query like the following: Select new mypackage.MyClass( u, max(sc.serviceDate)) from Unit
I have a migration that runs an SQL script to create a new Postgres
New to javascript/jquery and having a hard time with using this or $(this) to
I have found this example on StackOverflow: var people = new List<Person> { new
i'm quite new to postgres. i want to create a function (like stored procedure)
I'm new to postgres, so please take it easy on me. I'm trying to
I am very new to Postgres and the main problem I have now is
I'm trying to send a list of IPs from a Postgres query via e-mail.
New class is a subclass of the original object It needs to be php4

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.